I am writing a program in VB.NET that uses a Microsoft Access database. I can import it into a dataset just fine. Edit the dataset but when I have to program try to update the database with the changes it will only update the first table and then throw me an error when it gets to the second table:"" Missing the DataColumn 'CustomerName' in the DataTable 'Job' for the SourceColumn 'CustomerName'."" I should explain that my database has several tables (garyType is actually an array of the table names) and that each table has several columns. 'CustomerName' is only in the "Customer" table however and not in the "Job" table (which is what is trying to be updated on the second run of the For loop.
Code: VB
Dim garyType() As String = {"Customer", "Job", "CustomerType", "DateDelivered", "SiteManager", "Driver", "Material"}
oleConnection.Open()
If gDevLogDataSet.HasChanges Then
updateDevLog = gDevLogDataSet.GetChanges()
For i As Integer = 0 To (garyType.Length - 1)
strSQLFull = "SELECT * FROM " & garyType(i)
oleDevLogUpdate.SelectCommand = New OleDb.OleDbCommand(strSQLFull, oleConnection)
oleDevLogUpdate.Update(gDevLogDataSet, garyType(i))
[I] 'On the second run through the loop the error message that comes up while trying to run this line of code is: Missing the DataColumn 'CustomerName' in the DataTable 'Job' for the SourceColumn 'CustomerName' [/I]
oleConnection.Close()
updateDevLog.Tables(i).AcceptChanges()
gDevLogDataSet.Tables(i).AcceptChanges()
Next
End If
Thank you for your time.
