I have 3 tables in an Access database - tblMain, tblDelivery, and tblOtherCosts. tblMain is the parent table with a primary key (ID) and tblDelivery and tblOtherCosts are detail tables with foreign keys (ID) in a one to many relationship with tblMain. Update and delete events are set to cascade (via Dataset Designer in VB
I display data from all three tables on a form: I have a DataGridView bound to tblMain. tblDelivery and tblOtherCosts have their respective textboxes (bound to the appropriate fields) on the form. tblMain also has a DataNavigator on the form.
I fill the dataset with:
To save changes to the database, I use the following:
Private Sub TblMainBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TblMainBindingNavigatorSaveItem.Click
If I edit a value in the databound text box for tblDelivery or tblOtherCosts and try to save it (update) I get "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records". Does anyone know why this is, and how I should modify my code to fix it?