Manipulating DataTables with ADO.NET in C#

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

Guest

Hi,

I have a dataset, DataSetTemp which gets filled by the DataAdapter when
querying a SQL Server database. Only one table is populated in the data set.

I have another dataset, DataSetResults, which has two tables in it
DataTableResults and DataTableExceptions. I want to add all the rows from
DataSetTemp.DataTable[0] to DataTableResults. Bear in mind there is already
data in this table, which must be preserved - I just want to concatenate the
table with the rows from DataSetTemp.

How do I do that?

Thanks,
Mark.
 
Hi,

I think that this will have the effect of adding another table to the
dataset, no to concatenate two tables.


I dont remember any way that you can import a group of rows to a datatable,
what you can do is use DataTable.ImportRow

Now remember that there is omportant that both tables have the same
structure.



cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


Joyjit Mukherjee said:
DataSetResults.Merge(DataSetTemp.DataTable[0] , true, Add);

Regards
Joyjit


mark said:
Hi,

I have a dataset, DataSetTemp which gets filled by the DataAdapter when
querying a SQL Server database. Only one table is populated in the data set.

I have another dataset, DataSetResults, which has two tables in it
DataTableResults and DataTableExceptions. I want to add all the rows from
DataSetTemp.DataTable[0] to DataTableResults. Bear in mind there is already
data in this table, which must be preserved - I just want to concatenate the
table with the rows from DataSetTemp.

How do I do that?

Thanks,
Mark.
 
Back
Top