I'm trying to create a dynamic data command and data-adapter to populate a grid similar to the code below with autogenerateeditbutton='true'.
I know I need to populate the GridView1_RowEditing event but am unsure how to do that.
Several tries have been unsuccessful.
I'm trying to keep everything dynamic and do not know if I need to put my updatecommand in that event to make it workl ?
The table in the sql below could be choosen as a different table so in keeping everything dynamic I believe I'm going to have to populate the updatecommand in the rowediting event as something like update testtable set field1=@field1 where ...... and I'm not sure how to write that update process so it updates the row they are on when they click edit.
Its running in asp.net
Thank you for any help.
Dim SQL_String As String = "select * from testtable"
Dim connection As Data.SqlClient.SqlConnection
connection = New Data.SqlClient.SqlConnection("server=USFTW007FLN3G1\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=test")
Dim cmd As New Data.SqlClient.SqlCommand
Dim ds As New Data.DataSet
Dim dataadapter As Data.SqlClient.SqlDataAdapter
cmd.Connection = connection
cmd.CommandText = SQL_String
cmd.CommandType = Data.CommandType.Text
dataadapter = New Data.SqlClient.SqlDataAdapter(cmd)
GridView1.DataSource = ds