private void textBox1_TextChanged(object sender, EventArgs e) { try { formLogin user = new formLogin(); SqlConnection sqlcon = new SqlConnection(@"Data Source=MSI;Initial Catalog=cajero;User ID=team;Password=12345"); SqlCommand cmd = new SqlCommand("select accAvMoney from account where userIdFK=2 and accTypeFK=1", sqlcon); saldo.Text.Replace("", cmd.ToString()); } catch (Exception error) { } }
private void button1_Click(object sender, EventArgs e) { if (radioButton1.Checked) { this.valor = 10; } if (radioButton2.Checked) { this.valor = 20; } if (radioButton3.Checked) { this.valor = 30; } if (radioButton4.Checked) { this.valor = 100; } if (radioButton5.Checked) { this.valor = 200; } try { formLogin user = new formLogin(); SqlConnection sqlcon = new SqlConnection(@"Data Source=MSI;Initial Catalog=cajero;User ID=team;Password=12345"); SqlCommand cmd = new SqlCommand("update account set accAvMoney = accAvMoney-" + (valor), sqlcon); sqlcon.Open(); cmd.ExecuteNonQuery(); sqlcon.Close(); } catch (Exception error) { MessageBox.Show("Saldo insuficiente" + error); } Retiro3 r3 = new Retiro3(); r3.Show(); this.Hide(); }