Split a DataTable into two DataTables

M

MarkusJNZ

Hi, I have a DataTable which I want split into two other datatables
with the top 1/2 of the original datatable in one datatable and the
other 1/2 in another datatable.

Is there any easier way to do this other than iterating through the
original datatable row by row and copying the row to a new datatable??

Thanks
Markus
 
N

Nicholas Paldino [.NET/C# MVP]

Markus,

If you have a criteria that you could use to search through the
DataTable, you could use the Select method on the DataTable to select the
appropriate rows out, and then iterate through those, copying them over.
 
M

MarkusJNZ

Markus,

If you have a criteria that you could use to search through the
DataTable, you could use the Select method on the DataTable to select the
appropriate rows out, and then iterate through those, copying them over.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)




Hi, I have a DataTable which I want split into two other datatables
with the top 1/2 of the original datatable in one datatable and the
other 1/2 in another datatable.
Is there any easier way to do this other than iterating through the
original datatable row by row and copying the row to a new datatable??
Thanks
Markus- Hide quoted text -

- Show quoted text -

Hi, thanks for your help :)
Regards
Markus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top