Dim sCols() As String = {"xingming","xingbie","sfzhm","minzu","year","beizhu"}
Dim dCols() As String = {"xingming","xingbie","sfzhm","minzu","year","beizhu"}
Dim dt = DataTables("A表")
For Each dr As DataRow In dt.DataRows
Dim drs As List(Of DataRow) = DataTables("B表").Select("sfzhm= '" & dr("sfzhm") & "'")
If drs.count = 0 Then
Dim nr As DataRow = DataTables("xszzbb").AddNew()
For i As Integer =0 To sCols.Length -1
nr(dCols(i)) = dr(sCols(i))
Next
Else
For Each nr As DataRow In drs
For i As Integer =0 To sCols.Length -1
nr(dCols(i)) = dr(sCols(i))
Next
Next
End If
Next