Start a new topic

VistaDBDataAdapter 5.2 -- "Missing SourceTable mapping"

I am using VistaDB on .NET 4.5.2 winforms.  I open a form and populate databound fields from a dataset using a SQL Select and filled with a VistaDBDataAdapter.  Changes Made, press OK to update.  so I open a new Command on the same connection to post the edits back to the database.  The Code:


        Using vcmd As New VistaDBCommand(_SqlGet, vdbc)
            vcmd.Parameters.Add("@AnID", VistaDBType.Int).Value = _iAnID
            Using vda As New VistaDBDataAdapter(vcmd)
                Using cb As New VistaDBCommandBuilder(vda)
                    vda.MissingSchemaAction = MissingSchemaAction.AddWithKey
                    cb.ConflictOption = ConflictOption.OverwriteChanges ' This will restrict the where columns to the table primary key.
                    cb.SetAllValues = False
                    'vda.SelectCommand = 
                    'vda.TableMappings.Add("D_ANIMAL", "D_ANIMAL")
                    vda.InsertCommand = cb.GetInsertCommand(True)
                    vda.UpdateCommand = cb.GetUpdateCommand(True)
                    vda.DeleteCommand = cb.GetDeleteCommand(True)
                        vda.MissingMappingAction = MissingMappingAction.Error
                        _iRet = vda.Update(_ds, _ds.Tables(0).TableName)
                        If _iRet < 1 Then
                            DialogResult = DialogResult.Cancel
                            Me.Cursor = Cursors.Arrow
                            Exit Sub
                        End If
                    Catch ex As Exception
                        MessageBox.Show("Cannot update the " & _ds.Tables(0).TableName & " table, error=" & ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
                        DialogResult = DialogResult.Cancel
                        Me.Cursor = Cursors.Arrow
                        Exit Sub
                    End Try
                End Using
            End Using
        End Using

When I hit the update in this DataAdapter, I get this exception:
Missing SourceTable mapping: 'D_ANIMAL'

The query is "select {a list of columns] from D_ANIMAL where AN_ID = {integer key};" and is the same query used to fill the dataset _ds.

This code above is line for line identical to other code in the program that works.  Why is the Data Adapter failing to generate the proper mappings?  Exactly how do I remediate this?  If I brute force the mappings, it claims that it is missing column mappings for columns that are absolutely in the query and the underlying data table.

This is blocking a major release.  Please help ASAP.

1 Comment

We'll need more details from the exception (and its InnerException chain) that your app is getting to help analyze just where it's failing.  This would be better as a support ticket, so please email the details to (or you can open a ticket through the portal if you prefer).

Login to post a comment