老朱,既然是编码,就没有死活之说的:
Dim dtb As New DataTableBuilder("结果")
dtb.AddDef("名称", Gettype(String), 32)
For Each gx As String In DataTables("表A").GetValues("工序")
dtb.AddDef(gx & "_车间", Gettype(String), 32)
dtb.AddDef(gx & "_班组", Gettype(String), 32)
Next
dtb.Build()
For Each r1 As DataRow In DataTables("表A").dataRows
Dim r2 As DataRow
r2 = DataTables("结果").Find("名称 = '" & r1("名称") & "'")
If r2 Is Nothing Then
r2 = DataTables("结果").AddNew()
End If
r2("名称") = r1("名称")
r2(r1("工序") & "_车间") = r1("车间")
r2(r1("工序") & "_班组") = r1("班组")
Next
[此贴子已经被作者于2015/3/24 22:37:43编辑过]