Thursday, 19 September 2013

I got Exeption handling At ExexuteNonQuery at gridview in asp.net

I got Exeption handling At ExexuteNonQuery at gridview in asp.net

enter code here
Label lb = (Label)GridView1.Rows[e.RowIndex].FindControl("Label6");
TextBox tx1 =
(TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox1");
TextBox tx2 =
(TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox2");
mycon.Open();
SqlCommand myupdatecommand = new SqlCommand("update Users set
(user_name,user_surname) values('"+tx1.Text+"','"+tx2.Text+"') where
user_id='"+lb.Text+"'", mycon);
myupdatecommand.ExecuteNonQuery();
GridView1.EditIndex = -1;
GridView1.DataBind();

No comments:

Post a Comment