感觉你第二张“更改”表是手工录入的,那就在命令窗口中(做个按钮也行)这样试试:
Dim dr As DataRow
for i as integer = 0 to Tables("结果").count-1
dr = DataTables("更改").Find("材料编码 = '" & Tables("结果").rows(i)("材料编码") & "'")
dim wh as string = Tables("结果").rows(i)("装入位号")
if dr isnot nothing
if dr("单机量") = "-1" then '这是字符型的时候,数字型的不要加引号。。。
Tables("结果").rows(i)("装入位号") = wh.replace(dr("装入位号,"").trim()
else
Tables("结果").rows(i)("装入位号") = wh & " " & dr("装入位号")
end if
end if
next
[此贴子已经被作者于2011-4-25 18:39:04编辑过]