Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
- {
- if (e.CommandName == "btn")
- {
- int crow;
- crow = Convert.ToInt32(e.CommandArgument.ToString());
- string v = GridView1.Rows[crow].Cells[1].Text;
- int a = Int32.Parse(v);
- string b = "true";
- SqlConnection con = new SqlConnection("Data Source=DESKTOP-LITEG8T;Initial Catalog=UserDb;Integrated Security=True");
- con.Open();
- SqlCommand cmd = new SqlCommand("UPDATE Table_1 SET Status ='"+b+"' WHERE Id ='"+ a+"'", con);
- cmd.ExecuteNonQuery();
- con.Close();
- v = "";
- }
- }
- }[enter image description here][1]
Add Comment
Please, Sign In to add comment