I have been programming MS Access and VB 6 apps for many years. I have used VB.Net for various utility type of apps. I decided I needed to learn the ADO.NET and basic Database Apps in VB.Net so I started to go through a book.
My problem is that I have created a Suppliers Form with the Supplier Information in text boxes at the top of the form and a DataGrid showing the corrisponding Product records for that Supplier.
When I modify an item in the datagrid and press update the database is updated; but if I change any data in the text boxes for the Supplier info and press update, the database is not updated.
When I step through the code the GetChanges() method of the Suppliers Table in my DataSet object returns Nothing. So it thinks that there are no changes. It does not matter how many text boxes I edit, it never returns anything. The correct Supplier record info comes up, but changes are not ever saved.
Here is the code in my update Routine:
Me.NorthwindDataSet.Suppliers.AcceptChanges() 'Added this to make sure changes are getting to my table - still didn't work
Dim tbChanges As Data.DataTable = Me.NorthwindDataSet.Suppliers.GetChanges()
If Not tbChanges Is Nothing Then 'For some reasom this is always coming up as nothing, so it never updates
Me.SuppliersTableAdapter.Update(tbChanges) 'Also tried updating the Supplires table wheather there were changes or not - still didn't work
tbChanges = Me.NorthwindDataSet.Products.GetChanges()
If Not tbChanges Is Nothing Then 'This one works and updates but,
Me.ProductsTableAdapter.Update(tbChanges) 'Concurrency violation if you edit and save any data grid changes more than once