如何在vb.net中合并两列?

时间:2014-03-15 13:29:49

标签: vb.net

我在Vb.Net中有2个数据表

第一张表Table1

Accno ||名字|| databirth

100 ||赫马|| 10可能1990

200 || Chand ||

300 || arul ||

第二张表table2喜欢

Accno databirth

100 10-may-1990

200 23-Aug-1990

300 5-Jan-1989

但我需要Table1,如下面的Struture

Accno Name databirth

100 Hema 10-may-1990

200 Chand 23-Aug-1990

300 arul 1989年1月5日

1 个答案:

答案 0 :(得分:-1)

for i as byte = 0 to Table1.Rows.count-1

 dim row as datarow = Table1.rows(i)
 dim accno as integer = row("Accno")
 dim dr() as datarow = Table2.Select("Accno=" & accno)

 if dr.lenght>0 then
    if not string.isnullorempty(row("databirth").tostring) then
        row("databirth") = dr(0)("databirth")
    end if
 end if

 next

next