CREATE A DATASET

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I would like to add three table to a DataSet: these three tables have tha
same structure (columns name and type) but contains different records.

When I try to add them, at the second table, I receive an error: "This table
belongs already to another DataSet"

Could you please help me to solve the problem
 
You cannot hae two DataTables in a DataSet with the same name, whether the
DataTables have the same sturcture or not. To solve the problem, call first
DataTable "Table1", the second, "Table2", and so on, as long as they are
different.
 
You should also look at the DataTable.Clone method to ensure that you have a
completely separate instance of each table before you fill them with
records.

Allan
 
Hi Norman,
the table are three and they have different name... do you have other
suggestion?
I precise that the table are got from existing dataset and the three have
the same structure... here is my code:

DataTable dt1 = GetTableFromDataSet1();
DataTable dt2 = GetTableFromDataSet2();
DataTable dt3 = GetTableFromDataSet3();

Thanks for the help
 
Hi Allan,
the Clone method is interesting, but I would like to clone also the records,
not only the structure... is there a way to solve this issue? I don' want to
read sequentially the original table and fill the new one, because of low
performance!

Thanks
 
Hi Allan,
Clone method is interesting, but I would like to clone also the records...
is there a way to solve this issue? I don't want to read sequentially the
original table and fill the new one, because of low performance.

Thanks.
 
Back
Top