VB .NET Access update error

Discussion in 'Visual Basic ( VB )' started by casewolf, Apr 11, 2009.

  1. casewolf

    casewolf New Member

    Apr 11, 2009
    Likes Received:
    Trophy Points:
    Hi, I am new to this whole forum thing so please bear with me.
    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.
    Dim garyType() As String = {"Customer", "Job", "CustomerType", "DateDelivered", "SiteManager", "Driver", "Material"} 
            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]              
            End If
    I should mention that if only one table is being updated then the code works fine - no matter which table is being updated. But I should also mention that even when I get rid of the loop and just try to update each table individually it still throws the same error on the second table being updated.
    Thank you for your time.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice