For Each dr As DataRow In DataTables("表A").DataRows Dim fdr = DataTables("表B").find("姓名 = '" & dr("考生姓名") & "' and 证件号码 = '" & dr("身份证号") & "'") If fdr IsNot Nothing Then dr("姓名比对")=True dr("身份证比对")=True dr("比对结果")="建档户" Else dr("姓名比对")=False dr("身份证比对")=False dr("比对结果")="" End If Next