473,386 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

ado.net: best way to concatenate two DataTables

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
May 30 '07 #1
5 8628
"MattB" <so********@yahoo.comwrote in message
news:5c*************@mid.individual.net...
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

May 30 '07 #2
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/>
May 30 '07 #3
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
May 30 '07 #4
"MattB" <so********@yahoo.comwrote in message
news:5c*************@mid.individual.net...
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

May 30 '07 #5
Mark Rae wrote:
"MattB" <so********@yahoo.comwrote in message
news:5c*************@mid.individual.net...
>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
Jun 13 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Tippy G | last post by:
My name is Glenn, I am an experienced VB5.0/6.0 programmer who is starting a new project using VB.NET. The project is simple but will be using a .mdb file for storing of data. Only one person...
3
by: Travis | last post by:
I am trying to display a query like this in my windows form: SELECT workordernumber, date, firstname, lastname FROM customer_db; I am using a rich text box to display the data but it only...
2
by: mark | last post by:
Hi, I have a dataset, DataSetTemp which gets filled by the DataAdapter when querying a SQL Server database. Only one table is populated in the data set. I have another dataset, DataSetResults,...
7
by: JuLiE Dxer | last post by:
I can't seem to figure out which newsgroup I used to follow that pertained to ADO.NET... anyways, Is there a best method to programmatically update large DataTables into an Access DB file for...
3
by: aziz001DETESTSPAM | last post by:
I've been following some tutorials and reading books and have a basic grasp of the fundamental ADO.NET commands. But all the books I've read use a database with only 1 table. My database has many,...
20
by: Deano | last post by:
Just looking at C Sharp to see if it might be worth my while learning something new. Has anyone here tried a .NET language and tried to replicate a existing Access app? I would be interested to...
1
by: robdken | last post by:
I'm new to VB .NET and am just trying to get to grips with the capability of the software. I am trying to create a program that is able to import 3 different .csv files at a time, manipulate them...
6
by: Sheldon | last post by:
Hi, I am trying to build a large array using concatenate function in python. So as I loop over the number of arrays, of which there are 12 (4 down and 3 across), I create 3 long arrays by...
5
by: jehugaleahsa | last post by:
Hello: What is the point of using a DataTable in ASP .NET? We are unsure how you can use them without 1) rebuilding them every postback, or 2) taking up precious memory. We are not sure how to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.