DataAdapter.Update puzzle
In VS2005, variations on the code below work fine in XYZAdapter(Fill(XYZDataSet, "XYZTable")
XYZAdapter = Nothing ' cleared it to make sure it wasn't already there
XYZAdapter = DB.GetDataAdapter("XYZ") ' builds the adapter
' XYZAdapter.TableMappings.Add(XYZDataMap) ' works fine during Fill
Dim XYZCmdBldr = New SqlCommandBuilder(XYZAdapter)
XYZAdapter.Update(XYZDataSet, "XYZTable")
However, in the update attempt, when I comment out the TableMappings Line, I get:
>> Exception: Missing the DataColumn 'dbRecordType' in the DataTable 'XYZTable' for the SourceColumn 'dbRecordType'
(I map 'RecordType' to 'dbRecordType' in the mapping, which works during the Fill)
But when I include the TableMappings Line, I get:
>>Exception:The DataTableMapping is already contained by another DataTableMappingCollection.
(which I don't understand, at all)
Any help or debug suggestions on getting this Adapter.Update to work would be appreciated.
Thanks!
|