(datatable)A:
CompItem | Bom1
-------------|------------
a | 10
b | 20
c | 30(datatable)B:
CompItem | Bom2
-------------|-----------
a | 20
d | 30我希望把B表整合到A表中: CompItem | Bom1 | Bom2
-------------|-------|----
a | 10 | 20
b | 20 | 0
c | 30 | 0
d | 0 | 30 不知怎么操作Datatable才简单?
CompItem | Bom1
-------------|------------
a | 10
b | 20
c | 30(datatable)B:
CompItem | Bom2
-------------|-----------
a | 20
d | 30我希望把B表整合到A表中: CompItem | Bom1 | Bom2
-------------|-------|----
a | 10 | 20
b | 20 | 0
c | 30 | 0
d | 0 | 30 不知怎么操作Datatable才简单?
先查询出来,然后用Adapter.Fill(DataSet,TableName)不就可以了?
或者写一个类来存储
select t.CompItem,a.Bom1,b.Bom2
from
(select a.CompItem from a
union
select b.CompItem from b) as t
left join a on a.CompItem=t.CompItem
left join b on b.CompItem=t.CompItem
---------------------------------------
做人要厚道,记得给分!!!!!!
你的不是两个父表吧!