Advertisement
Guest User

ccc

a guest
Apr 13th, 2012
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1.   protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
  2.         {
  3.             int index = Convert.ToInt32(e.CommandArgument);
  4.             string sqlQuery = "Update mytable set ID = @ID WHERE No ="+ index;
  5.             GridOpen(sqlQuery);
  6.  
  7.         }
  8.         void GridOpen(string send)
  9.         {
  10.             string con = "conn string";
  11.             using (SqlConnection dataConnection = new SqlConnection(con))
  12.             {
  13.                 using (SqlCommand dataCommand = new SqlCommand(send, dataConnection))
  14.                 {
  15.                     int ld = 121;
  16.                     dataCommand.Parameters.AddWithValue("ID", ld);
  17.                     dataConnection.Open();
  18.                     dataCommand.ExecuteNonQuery();
  19.                     dataConnection.Close();
  20.  
  21.                 }
  22.  
  23.             }
  24.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement