Mapping single table to many tables

  • Thread starter Thread starter Dimitris
  • Start date Start date
D

Dimitris

Hallo people,

is it possible to map the columns return by a sql select command to a
DataAdapter to different tables in ADO.NET? I tried the tablemappings
collection but got the following error message:
"The DataTableMapping.SourceTable is required to be unique, 'Table'
already exists in the collection."
with following code:
DataAdapter.TableMappings.AddRange
(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "FirstTable",
new System.Data.Common.DataColumnMapping[]
{new System.Data.Common.DataColumnMapping bla bla...}),
new System.Data.Common.DataTableMapping("Table", "SecondTable",
new System.Data.Common.DataColumnMapping[]
{new System.Data.Common.DataColumnMapping bla bla...}),
new System.Data.Common.DataTableMapping("Table", "ThirdTable"
bla bla...)})
It would seem logical that ADO.NET would support this. Any advice is
more than welcome.

Regards,
Dimitris Tziouris
 
Hi Dimitris,

Easies way is to use proper Fill method that takes a DataTable instance as a
parameter....
 
Back
Top