我正在获取NULLREFERENCEEXCEPTION
网格视图中的更新查询。
protected void GridView1_RowUpdating(Object sender, GridViewUpdateEventArgs e)
{
TextBox txtname = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtname1");
cmd.Connection = con;
cmd.CommandText = "update test1 set Name='" + txtname.Text + "' where Roll_No = '"
+ GridView1.DataKeys[e.RowIndex].Values[0].ToString() + "'";
con.Open();
int temp = cmd.ExecuteNonQuery();
if (temp == 1)
{
Label1.Text = "Record updated sucessfully";
}
GridView1.EditIndex = -1;
FillGrid();
con.Close();
}