SHARE
TWEET

ccc

a guest Apr 13th, 2012 26 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.         }
RAW Paste Data
Want to get better at C#?
Learn to code C# in 2017
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top