DataRows into a DataTable

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

Guest

If you want to add all rows from one table into another... is there an easier
way of doing this... other than stepping through the Rows collection of the
source table and importing each row into the destination table?
 
Good news is that V2.0 has a DataTableReader that does this for you ... not
much help at the moment though!
 
Hi ,
U can use..........

dim dtNewTable as datatable

'It will copy all the Row of dtOldTable into dtNewTable Table
dtNewTable = dtOldTable.Copy

Regards,
Ritesh
 
2 ways to do this ----

1. DataTable.Copy
2. Add DT to a dataset, serialize the dataset, deserialize to a new copy
(hence u'd clone it), get the table from there (why would u bother doing
this?)

In either of the above cases what you get is a deep copy.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
 
I don't think my question was very clear... ok here's a better example... I
have two DataTables... with identical columns... and I want to create a third
DataTable... with all of the rows from the first two DataTables...

I can do a DataTable.Copy for the first one... then import each row... is
that the best way to do this sort of thing?
 
Hi,
U can add New Blank Table in Dataset (I assume Schema of all three Tables are Same)

in first step Just Copy the 1st Table into 3rd Table and then go for Merge Method of Dataset to Add 2nd Table into 3rd Table.

Regards,
Ritesh
 
Back
Top