Dim row As DataRow
Dim rows As DataRow()
For Each row In DataTable1.Rows
rows = DataTable2.Select("DataTable1的列名=" & row(0).ToString.Trim ) '条件
If Not rows.Length = 0 Then
'差集
MsgBox("差集:" & row(0).ToString.Trim) 'DataTable1中的差集数据
Else
'交集
MsgBox("交集:" & row(0).ToString.Trim) 'DataTable1中的交集数据
'遍历DataTable2中的交集数据 -- 遍历DataRow
For Each r In rows
MsgBox(r.Item(0).ToString)
Next
End If
Next