Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2007

Tip: Looking for answers? Try searching our database.

ado.net: best way to concatenate two DataTables

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MattB - 30 May 2007 20:22 GMT
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
Mark Rae - 30 May 2007 21:18 GMT
> 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?sourceid=navclient&aq=t&hl=en-GB&ie=UTF-8&rlz=1T4
GGIH_en-GBGB220GB220&q=DataTable+merge


Signature

http://www.markrae.net

Tim Van Wassenhove - 30 May 2007 21:44 GMT
MattB schreef:
> asp.net 1.1
>
[quoted text clipped - 3 lines]
> might be pretty inefficient. Is there a cleaner way or is looping my
> best bet?

What about using DataSet.Merge?

Signature

Tim Van Wassenhove - Read my mind <url:http://www.timvw.be/>

MattB - 30 May 2007 22:45 GMT
> asp.net 1.1
>
[quoted text clipped - 5 lines]
>
> 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
Mark Rae - 30 May 2007 23:26 GMT
> 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...?

Signature

http://www.markrae.net

MattB - 13 Jun 2007 21:20 GMT
>> 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.