I have following in my window form:
sqlconnection1
sqladaptor
dataset1
Datagrid1
my data-grid data-source being set with "dataset1" which is basically SQL statement "select name,address from myTable"
I can see the table coulmn name as headres of my Grid. I ran the application and manged to enter "FirstName", "Address" in the grids. Now I need to insert all the rows from Grid to my Table called "myTable" which basically the data-source for my DataGrid.
How can I do this ? Kindly advise..
I have seen below code in the form code-behind page. Will it help anywhere ? This code is system generated upon creation of dataset from data-adaptor
Appreciate your help...
sqlconnection1
sqladaptor
dataset1
Datagrid1
my data-grid data-source being set with "dataset1" which is basically SQL statement "select name,address from myTable"
I can see the table coulmn name as headres of my Grid. I ran the application and manged to enter "FirstName", "Address" in the grids. Now I need to insert all the rows from Grid to my Table called "myTable" which basically the data-source for my DataGrid.
How can I do this ? Kindly advise..
I have seen below code in the form code-behind page. Will it help anywhere ? This code is system generated upon creation of dataset from data-adaptor
VB.NET:
'SqlInsertCommand1
'
Me.SqlInsertCommand1.CommandText = "INSERT INTO myTable(name, address) VALUES (@name, @address); SELECT name, address F" & _
"ROM myTable"
Me.SqlInsertCommand1.Connection = Me.SqlConnection1
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@name", System.Data.SqlDbType.VarChar, 10, "name"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@address", System.Data.SqlDbType.VarChar, 10, "address"))
Last edited by a moderator: