Fastest DataRow Copy?

L

localhost

I have two DataSets and need to get DataRows from one DataTable into
another. Is this the fastest way? I am after pure speed no matter
what the "cost", in this case.


DataRow[] dataRows = oldSet.Tables["OldTable"].Select();
for ( int dwC=0 ; dwC < dataRows.Length ; dwC++ )
{
DataRow newRow = newSet.Tables["NewTable"].NewRow();
newuRow.ItemArray = dataRows[dwC].ItemArray;
}
newSet.Tables["NewTable"].AcceptChanges();



Thanks.
 
L

localhost

Thanks, but I need to append data from one DataTable into another one,
I don't want a copy because that will destroy what's already in the
destination table.

Looking for any tricks to do the fastest insert/append possible
between DataTables in different DataSets.

Thanks.



Localhost,

I never tested it, however I think that the datatable.copy will be the
fastest.

http://msdn.microsoft.com/library/d...ml/frlrfsystemdatadatatableclasscopytopic.asp

I hope this helps?

Cor

localhost said:
I have two DataSets and need to get DataRows from one DataTable into
another. Is this the fastest way? I am after pure speed no matter
what the "cost", in this case.


DataRow[] dataRows = oldSet.Tables["OldTable"].Select();
for ( int dwC=0 ; dwC < dataRows.Length ; dwC++ )
{
DataRow newRow = newSet.Tables["NewTable"].NewRow();
newuRow.ItemArray = dataRows[dwC].ItemArray;
}
newSet.Tables["NewTable"].AcceptChanges();



Thanks.
 

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