Home All Groups Group Topic Archive Search About
Author
9 Dec 2004 5:59 AM
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.

Author
9 Dec 2004 9:24 AM
Cor Ligthert
Localhost,

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

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatatableclasscopytopic.asp

I hope this helps?

Cor

Show quote
"localhost" <primpi***@cohort.ces> schreef in bericht
news:t7qfr0t5mbrgkkf5mfppi3ui5ejg962jkg@4ax.com...
>
> 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.
>
>
Author
10 Dec 2004 2:48 PM
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.



On Thu, 9 Dec 2004 10:24:37 +0100, "Cor Ligthert"
<notmyfirstn***@planet.nl> wrote:

Show quote
>Localhost,
>
>I never tested it, however I think that the datatable.copy will be the
>fastest.
>
>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatatableclasscopytopic.asp
>
>I hope this helps?
>
>Cor
>
>"localhost" <primpi***@cohort.ces> schreef in bericht
>news:t7qfr0t5mbrgkkf5mfppi3ui5ejg962jkg@4ax.com...
>>
>> 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.
>>
>>
>
Author
10 Dec 2004 3:30 PM
Cor Ligthert
> 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.
>
You did not say that, than is this one probably the best

importrow

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatatableclassimportrowtopic.asp

I hope this helps?

Cor

AddThis Social Bookmark Button