Dim lst As new List(of String)
For Each dr As DataRow In DataTables("表A").Select("编码 is not null and 编码 <> ''")
Dim fdr As DataRow = DataTables("表B").find("编码='" & dr("编码") & "'")
If fdr IsNot Nothing Then
For Each dc As DataCol In DataTables("表A").DataCols
If DataTables("表B").DataCols.Contains(dc.name) AndAlso dc.name <> "序号"
dr(dc.name) = fdr(dc.name)
End If
Next
Else
lst.add(dr("编码"))
End If
Next
If lst.Count > 0
Dim s As String = String.join(vbcrlf,lst.ToArray)
MessageBox.Show(s)
End If