惭愧,我读书时容易看错题,总是考不出高分,老了还是这样。
反过来还是一样:
DataTables("表A").DataRows.Clear()
For Each dr1 As DataRow In DataTables("表B").DataRows
For Each dc As DataCol In DataTables("表B").DataCols
Dim pts() As String = dc.Name.Split("_")
If pts.Length = 2 Then
If pts(1) = "车间" Then
Dim dr2 As DataRow = DataTables("表A").AddNew()
dr2("名称") = dr1("名称")
dr2("工序") = pts(0)
dr2("车间") = pts(1)
dr2("班组") = dr1(pts(0) & "_" & "班组")
End If
End If
Next
Next