protected void griddelete_RowUpdating(object sender, GridViewUpdateEventArgs e) { using (SqlConnection con = new SqlConnection(cs)) { GridViewRow updaterow = (GridViewRow)griddelete.Rows[e.RowIndex]; TextBox updatel1 = (TextBox)updaterow.FindControl("txtempidrow"); TextBox updatel2 = (TextBox)updaterow.FindControl("txtnamerow"); TextBox updatel3 = (TextBox)updaterow.FindControl("txtjobrow"); string update = "update emp set job=@job,ename=@ename where empno=@empno"; con.Open(); SqlCommand cmd = new SqlCommand(update,con); cmd.Parameters.AddWithValue("@empno", updatel1.Text); cmd.Parameters.AddWithValue("@ename", updatel2.Text); cmd.Parameters.AddWithValue("@job", updatel3.Text); cmd.ExecuteNonQuery(); griddelete.EditIndex = -1; lblmsg.Text = "Data Updated successfully"; bind(); } }
try catch
Updatel1
table
bind()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)