This code snippet is throwing an error:
Update unable to find TableMapping[\'Table\'] or DataTable \'Table\'.) on adapter.Update(ds); line
It's because .NET cannot assume that the table name in the DataSet
/DataTable
is identical to the database table. Thus .NET warns you about it.
To solve it you need to add a mapping to the DataAdapter
:
da.TableMappings.Add("TableNameInDb", "TableNameInTheDataSet");
However, even if you have specified a name in the DataSet
or the DataSource
it still doesn't work, since the adapter seems to forget the name.
I only got it working by using:
da.TableMappings.Add("Table", "TableNameInDb");