Question about the DataSet Merge.

  • Thread starter Thread starter Benny Ng
  • Start date Start date
B

Benny Ng

Dear All,

Now i have a two dataset. they have same db structure and same columns and
same rows.

just the content is not same between them.

for example:

datagrid 1:

name,sex,order_quality
shenzhen benny,male,1000
shanghai allen,male,2000
hangzhou kevin,male,3000

datagrid 2:
name,sex,order_quality
shenzhen dragon,male,1000
shanghai leo,male,2000
hangzhou james,male,3000

sturcture is sames as the datagrid1.

now i want to merge them into one datagrid. how to do it? (i can't used
ado's Merge command, because it's not full fill my requirement).

i want the combination of these two grids into:

name,sex,order_quality,name1,sex1,order_quality1
shenzhen benny,male,1000,dragon,male,1000
shanghai allen,male,2000,leo,male,2000
hangzhou kevin,male,3000,james,male,3000

how to do it for the combination of the above?

because the Merge command is only for the data merger for vertical. not
for the horizontal. Now i must to used two for...loop...to finish this
requirement.

But I thinking whether i can get an easily ways to finish that. How is yor
suggestion?

Thanks,

Benny Ng
 
When you do your query, simply change the names at that time for the 2nd
dataset, i.e., Select Name as Name1, Sex as Sex1, Order_Quality as
Order_Quality1. When you do your merge, since the columns are not identical,
the merge will be "horizontal" instead of vertical.
 
Thanks,Earl,

I think it's can be useful to me. But for me. Actually i need to used
execute two stored procedure to make it. (this two stored procedures is same
only the parameters is different.)

I'm still thinking.

Benny Ng
 
Back
Top