如何在vb.net中合并这两列?
我在Vb.Net中有两个数据表 第一个表如何在vb.net中合并这两列?,vb.net,Vb.net,我在Vb.Net中有两个数据表 第一个表表1类似 账号| |姓名| |数据出生 100 |赫马| 1990年5月10日 200 | |钱德|| 300 | |阿鲁尔| | 第二个表表2类似 阿克诺数据出生 100 1990年5月10日 200 1990年8月23日 300 1989年1月5日 for i as byte = 0 to Table1.Rows.count-1 dim row as datarow = Table1.rows(i) dim accno as integer =
表1
类似
账号| |姓名| |数据出生
100 |赫马| 1990年5月10日
200 | |钱德||
300 | |阿鲁尔| |
第二个表表2
类似
阿克诺数据出生
100 1990年5月10日
200 1990年8月23日
300 1989年1月5日
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
但我需要表1
如下结构
帐户名数据出生
100赫马1990年5月10日
200年Chand 1990年8月23日
300 AROL 5-JAN-1989
请考虑你的答案,里面有很多问题。当您只使用一个NEXT时,您有两个NEXT,并且lenght应该是length。这甚至不会运行。。。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