GridViewRow row = (GridViewRow)ResultGridView.Rows[e.RowIndex]; Label lbl = (Label)row.FindControl("lblid"); TetBox txextname = (TextBox)row.FindControl("textbox1"); TextBox textmarks = (TextBox)row.FindControl("textbox2"); ResultGridView.EditIndex = -1; conn.Open(); OleDbCommand cmd = new OleDbCommand("update db1 set Names='" + textname.Text + "' , Number='" + textmarks.Text + "' where Id='" + lbl.Text + "'",conn); //.CommandText = "Update StudentRecord set Name='" + txtname.Text + "',ClassName='" + txtclassname.Text + "',RollNo='" + txtrollno.Text + "',EmailId='" + txtemailid.Text + "' where StId='" + lblstid.Text + "'"; cmd.CommandType = CommandType.Text; OleDbDataAdapter da = new OleDbDataAdapter(cmd); cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); conn.Close(); bind();
parameterized queries
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)