Hi,
I have done the following code for databinding a datagrid to a dataset which is filled by a query I make on a database table.
PrivateSub dgDataMain_Databind()
'Bind the Data in ShedMain to the DataGrid
'The DataSet that holds the data.
Dim dsMain As DataSet
'Load the data.
Dim daMain As SqlDataAdapter
'Create the SqlDataAdapter.
Dim strSQL AsString = GetdgDataMainSQLStr() 'The query string
daMain = New SqlDataAdapter(strSQL, conn) 'conn is defined publicly
'Map Table to ShedMain.
daMain.TableMappings.Add("Table", "ShedMain")
'Fill the DataSet.
dsMain = New DataSet
daMain.Fill(dsMain)
'Bind the DataGrid control to the ShedMain DataTable.
dgDataMain.SetDataBinding(dsMain, "ShedMain")
EndSub
This function is called on loading the form, and on inserting a new record in the ShedMain table, after validation and the new row is committed.
Now, what I would like to know is how to go about reflecting updates in the datagrid cells/rows to the database table 'ShedMain'.
What I would like is that on changing the cells of the datagrid, the user presses an 'Update' button, then the same (if possible?) validation function that is used for A SINGLE NEW INSERTION OF A NEW ROW will be used on all the changed rows and ultimately change the 'ShedMain' table.
I would greatly appreciate any help...Thanks in advance!
Timothy
I have done the following code for databinding a datagrid to a dataset which is filled by a query I make on a database table.
PrivateSub dgDataMain_Databind()
'Bind the Data in ShedMain to the DataGrid
'The DataSet that holds the data.
Dim dsMain As DataSet
'Load the data.
Dim daMain As SqlDataAdapter
'Create the SqlDataAdapter.
Dim strSQL AsString = GetdgDataMainSQLStr() 'The query string
daMain = New SqlDataAdapter(strSQL, conn) 'conn is defined publicly
'Map Table to ShedMain.
daMain.TableMappings.Add("Table", "ShedMain")
'Fill the DataSet.
dsMain = New DataSet
daMain.Fill(dsMain)
'Bind the DataGrid control to the ShedMain DataTable.
dgDataMain.SetDataBinding(dsMain, "ShedMain")
EndSub
This function is called on loading the form, and on inserting a new record in the ShedMain table, after validation and the new row is committed.
Now, what I would like to know is how to go about reflecting updates in the datagrid cells/rows to the database table 'ShedMain'.
What I would like is that on changing the cells of the datagrid, the user presses an 'Update' button, then the same (if possible?) validation function that is used for A SINGLE NEW INSERTION OF A NEW ROW will be used on all the changed rows and ultimately change the 'ShedMain' table.
I would greatly appreciate any help...Thanks in advance!
Timothy