Guest User

Untitled

a guest
Jun 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
  2. {
  3. if (e.CommandName == "btn")
  4. {
  5. int crow;
  6. crow = Convert.ToInt32(e.CommandArgument.ToString());
  7. string v = GridView1.Rows[crow].Cells[1].Text;
  8. int a = Int32.Parse(v);
  9. string b = "true";
  10. SqlConnection con = new SqlConnection("Data Source=DESKTOP-LITEG8T;Initial Catalog=UserDb;Integrated Security=True");
  11. con.Open();
  12. SqlCommand cmd = new SqlCommand("UPDATE Table_1 SET Status ='"+b+"' WHERE Id ='"+ a+"'", con);
  13. cmd.ExecuteNonQuery();
  14. con.Close();
  15. v = "";
  16.  
  17. }
  18. }
  19. }[enter image description here][1]
Add Comment
Please, Sign In to add comment