How do I save changes in my db from my datagrid?
Posted on 2006-11-21
What I'm trying to do is modify my program so that when the user edits a value in the datagrid, it automatically changes the table in the db. Any help on this matter would be greatly appreciated. Here is the code I use to bind the datagrid to the db..
As you can see I'm using a bindingSource object to link both the datagrid and the bindingNavigator..
Private bindingSource1 As New BindingSource
Public Sub bindTable()
Dim dbAdapter = New OleDbDataAdapter()
Dim dtResults = New DataTable("Results")
Me.lblTotal.Text = "Total: " & mydb.myRecordSet.RecordCount
Me.bindingSource1.DataSource = dtResults
Me.BindingNavigator1.BindingSource = bindingSource1
Me.mydatagrid.DataSource = bindingSource1
dbAdapter = Nothing
dtResults = Nothing