Exception thrown when saving record modifications to database.
I placed a binding navigator on a windows form that accesses an access table. Everything behaves as expected, except in the case of when I click the save button on the binding navigator. Below is the code for the event:
Private Sub TblDMPartBaseBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles TblDMPartBaseBindingNavigatorSaveItem.Click
Me.Validate()
Me.TblDMPartBaseBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me._MasterBase_02DataSet)
Me.Close()
End Sub
The line in italics, above, is where the break takes place and I get the following exception:
An unhandled exception of type 'System.InvalidOperationException' occurred in SiTechDocumentMaster.00.exe
Additional information: Update requires a valid UpdateCommand when passed DataRow collection with
I use the same code, except on a different table, in another project using this same dataset with no issues. I have looked in a lot of places and am unable to discern why this code does not work. Anyone have any ideas?
Re: Exception thrown when saving record modifications to database.
If it's a different table in a different project it's not the same dataset.
Regardless, it tells you what the problem is - you're missing an Update SQL Statement in your dataset/adaptor. You can't update the data unless you tell it how to update it. If this (or similar) code worked in a different project then it's probably because it did include the Update Statement.
-tg
Re: Exception thrown when saving record modifications to database.
I think I understand. I was starting to wonder about datasets and different projects using them. So the gist of what I get from you is that the (a) dataset must exist in each project. This sounds like it could get confusing. What I have is an Access database with about 100 tables doing different jobs within the access framework. All of these tables, lookups, lists, etc. are interrelated in that they are used for data for related activities. So then if I have a different dataset of the same database that exists in each project does that mean that when I make changes to the database I need to re-configure each of the datasets in each of the projects?