Home All Groups Group Topic Archive Search About

Question about the DataSet Merge.

Author
24 Nov 2006 6:58 AM
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

Author
25 Nov 2006 6:20 PM
Earl
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.

Show quote
"Benny Ng" <benny_wuf***@hotmail.com> wrote in message
news:%2354ssf5DHHA.4312@TK2MSFTNGP06.phx.gbl...
> 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
>
>
>
Author
27 Nov 2006 6:12 AM
Benny Ng
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

Show quote
"Earl" <brikshoe@newsgroups.nospam> wrote in message
news:u9Lve5LEHHA.3520@TK2MSFTNGP04.phx.gbl...
> 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.
>
> "Benny Ng" <benny_wuf***@hotmail.com> wrote in message
> news:%2354ssf5DHHA.4312@TK2MSFTNGP06.phx.gbl...
>> 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
>>
>>
>>
>
>

AddThis Social Bookmark Button