ado.net: best way to concatenate two DataTables

Discussion in 'ASP .Net' started by MattB, May 30, 2007.

  1. MattB

    MattB Guest

    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
     
    MattB, May 30, 2007
    #1
    1. Advertising

  2. MattB

    Mark Rae Guest

    Mark Rae, May 30, 2007
    #2
    1. Advertising

  3. 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/>
     
    Tim Van Wassenhove, May 30, 2007
    #3
  4. MattB

    MattB Guest

    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
     
    MattB, May 30, 2007
    #4
  5. MattB

    Mark Rae Guest

    "MattB" <> wrote in message
    news:...

    > 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
     
    Mark Rae, May 30, 2007
    #5
  6. MattB

    MattB Guest

    Mark Rae wrote:
    > "MattB" <> wrote in message
    > news:...
    >
    >> 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
     
    MattB, Jun 13, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Randy Smith
    Replies:
    1
    Views:
    482
    Marina
    May 9, 2005
  2. roxorsoxor2345
    Replies:
    4
    Views:
    483
    Nate Barney
    Oct 6, 2006
  3. Diego Martins
    Replies:
    5
    Views:
    5,284
    Diego Martins
    Jun 19, 2007
  4. Bauhaus
    Replies:
    0
    Views:
    428
    Bauhaus
    May 10, 2008
  5. Carlos

    Concatenate/De-Concatenate

    Carlos, Oct 12, 2012, in forum: VHDL
    Replies:
    10
    Views:
    886
Loading...

Share This Page