Combine multiple dataset columns to one dataset

Posted by Matt on Stack Overflow See other posts from Stack Overflow or by Matt
Published on 2010-05-19T18:40:23Z Indexed on 2010/05/25 5:01 UTC
Read the original article Hit count: 642

Filed under:
|
|
|
|

I have multiple datasets that I would like to combine into one. There is a common ID field that can be associated to each row. Calling Merge on the dataset will add additional rows to the dataset, but I would like to combine the additional columns. There are too many fields to do this in one query and therefore would make it unmanageable. Each individual query would be able to handle ordering to ensure the data is placed in the correct row.

For Example lets say I have two queries resulting in two datasets:

SELECT ID, colA, colB
SELECT colC, colD

The resulting dataset would look like

ID colA colB colC colD
1  a    b    c    d
2  e    f    g    h

Any ideas on ways to accomplish this?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about vb.net