PC Review


Reply
Thread Tools Rate Thread

ado.net: best way to concatenate two DataTables

 
 
MattB
Guest
Posts: n/a
 
      30th May 2007
asp.net 1.1

I have two DataTables with identical structures I want to combine, as if
I had used UNION in the select statement. I know I could just loop
through and add rows from one table to the other but that seems like it
might be pretty inefficient. Is there a cleaner way or is looping my
best bet? Thanks!

Matt
 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      30th May 2007
"MattB" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> I have two DataTables with identical structures I want to combine, as if I
> had used UNION in the select statement. I know I could just loop through
> and add rows from one table to the other but that seems like it might be
> pretty inefficient. Is there a cleaner way or is looping my best bet?
> Thanks!


http://www.google.co.uk/search?sourc...ataTable+merge


--
http://www.markrae.net

 
Reply With Quote
 
Tim Van Wassenhove
Guest
Posts: n/a
 
      30th May 2007
MattB schreef:
> asp.net 1.1
>
> I have two DataTables with identical structures I want to combine, as if
> I had used UNION in the select statement. I know I could just loop
> through and add rows from one table to the other but that seems like it
> might be pretty inefficient. Is there a cleaner way or is looping my
> best bet?


What about using DataSet.Merge?


--
Tim Van Wassenhove - Read my mind <url:http://www.timvw.be/>
 
Reply With Quote
 
MattB
Guest
Posts: n/a
 
      30th May 2007
MattB wrote:
> asp.net 1.1
>
> I have two DataTables with identical structures I want to combine, as if
> I had used UNION in the select statement. I know I could just loop
> through and add rows from one table to the other but that seems like it
> might be pretty inefficient. Is there a cleaner way or is looping my
> best bet? Thanks!
>
> Matt


Thanks to you both! I actually found a way to do this without having to
combine the tables, so the problem went away.

Matt
 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      30th May 2007
"MattB" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> Thanks to you both! I actually found a way to do this without having to
> combine the tables, so the problem went away.


Are you going to share it with the group...?


--
http://www.markrae.net

 
Reply With Quote
 
MattB
Guest
Posts: n/a
 
      13th Jun 2007
Mark Rae wrote:
> "MattB" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
>> Thanks to you both! I actually found a way to do this without having
>> to combine the tables, so the problem went away.

>
> Are you going to share it with the group...?
>
>


No. But only because it doesn't really apply to the original question.
Basically it boiled down to a better SQL query using UNION instead of
two distinct queries.

Matt
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
About datatables Ravindra Microsoft ADO .NET 6 30th Dec 2005 01:20 PM
DataTables bernardpace@yahoo.com Microsoft C# .NET 2 20th Aug 2005 04:03 PM
DataTables bernardpace@yahoo.com Microsoft C# .NET 1 19th Aug 2005 12:29 PM
I know how to concatenate ,can one de-concatenate to split date? =?Utf-8?B?UVVJQ0sgQk9PS1MgUFJPQkxFTS0=?= Microsoft Excel New Users 1 26th Jul 2005 05:07 PM
Datatables Debra Coleman Microsoft Excel Worksheet Functions 1 19th Sep 2003 03:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:31 AM.