I have a relational Database with tables for "App", CoApp' and "Property". I have from with DataGridViews for each of these tables. I have set up the "Update" function in a Transaction and it works perfectly, for Adding, Deleting and Modifying. However when I replace on of the DataGridViews with individual controls from exactly the same table, then my "Update" function does not work. Can someone offer an explanation. The code I am currently using is as below:
Private
Sub TblAppBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TblAppBindingNavigatorSaveItem.ClickMe.Validate()Me.TblAppBindingSource.EndEdit()Me.TblAppTableAdapter.Update(Me.LTDBDataSet.tblApp)'Set dims for first Child Table (CoApp)Dim deletedChildCoApp As LTDBDataSet.tblCoAppDataTable = CType(LTDBDataSet.tblCoApp.GetChanges(Data.DataRowState.Deleted), LTDBDataSet.tblCoAppDataTable)Dim newChildCoApp As LTDBDataSet.tblCoAppDataTable = CType(LTDBDataSet.tblCoApp.GetChanges(Data.DataRowState.Added), LTDBDataSet.tblCoAppDataTable)Dim modifiedChildCoApp As LTDBDataSet.tblCoAppDataTable = CType(LTDBDataSet.tblCoApp.GetChanges(Data.DataRowState.Modified), LTDBDataSet.tblCoAppDataTable)'Set dims for second Child Table (PropBank)Dim deletedChildPropBank As LTDBDataSet.tblPropBankDataTable = CType(LTDBDataSet.tblPropBank.GetChanges(Data.DataRowState.Deleted), LTDBDataSet.tblPropBankDataTable)Dim newChildPropBank As LTDBDataSet.tblPropBankDataTable = CType(LTDBDataSet.tblPropBank.GetChanges(Data.DataRowState.Added), LTDBDataSet.tblPropBankDataTable)Dim modifiedChildPropBank As LTDBDataSet.tblPropBankDataTable = CType(LTDBDataSet.tblPropBank.GetChanges(Data.DataRowState.Modified), LTDBDataSet.tblPropBankDataTable)'Update First Child Table (CoApp)TryIf deletedChildCoApp IsNotNothingThenTblCoAppTableAdapter.Update(deletedChildCoApp)
EndIfTblAppTableAdapter.Update(LTDBDataSet)
If newChildCoApp IsNotNothingThenTblCoAppTableAdapter.Update(newChildCoApp)
EndIfIf modifiedChildCoApp IsNotNothingThenTblCoAppTableAdapter.Update(modifiedChildCoApp)
EndIfLTDBDataSet.AcceptChanges()
Catch ex As ExceptionFinallyIf deletedChildCoApp IsNotNothingThendeletedChildCoApp.Dispose()
EndIfIf newChildCoApp IsNotNothingThennewChildCoApp.Dispose()
EndIfIf modifiedChildCoApp IsNotNothingThenmodifiedChildCoApp.Dispose()
EndIfEndTry'Update Second Child Table (PropBank)TryIf deletedChildPropBank IsNotNothingThenTblPropBankTableAdapter.Update(deletedChildPropBank)
EndIfTblCoAppTableAdapter.Update(LTDBDataSet)
If newChildPropBank IsNotNothingThenTblPropBankTableAdapter.Update(newChildPropBank)
EndIfIf modifiedChildPropBank IsNotNothingThenTblPropBankTableAdapter.Update(modifiedChildPropBank)
EndIfLTDBDataSet.AcceptChanges()
Catch ex As ExceptionFinallyIf deletedChildPropBank IsNotNothingThendeletedChildPropBank.Dispose()
EndIfIf newChildPropBank IsNotNothingThennewChildPropBank.Dispose()
EndIfIf modifiedChildPropBank IsNotNothingThenmodifiedChildPropBank.Dispose()
EndIfMsgBox(
"DataBase has been successfully updated")EndTryEndSub