working with windows forms

Oct 28 2009 9:32 AM
i m inserting values to database using executeNonQuery on debugging its working but changes r not reflected to database private void BtnCommit_Click(object sender, EventArgs e) {//dekho int amtwith = Convert.ToInt32(txtAmount.Text.Trim()); int bal = Balance() - amtwith; con.Open(); SqlCommand cmd = new SqlCommand("update balance set bal=@bal where cardno=@cno", con); cmd.Parameters.AddWithValue("@bal", bal); cmd.Parameters.AddWithValue("@cno",this.CardNo); cmd.ExecuteNonQuery(); balance is Rs." + bal); con.Close(); }

Answers (2)