以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  问题出在哪?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=113540)

--  作者:gudao123456
--  发布时间:2018/1/17 22:26:00
--  问题出在哪?

比对表A中的记录是否在表B中,以下代码正确吗?问题在哪?

 

For Each dr As DataRow In DataTables("A").DataRows

      dr("姓名比对")=False

      dr("身份证比对")=False

      dr("比对结果")=""

 

    For Each tr As DataRow In DataTables("表B").DataRows

       If dr("考生姓名")=tr("姓名") And dr("身份证号")=tr("证件号码")

         dr("姓名比对")=True

         dr("身份证比对")=True

         dr("比对结果")="建档户"

        

       End If

    

Next

Next

 

比对的结果不正确,不知何因?请求帮助


--  作者:有点甜
--  发布时间:2018/1/17 23:03:00
--  

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

--  作者:gudao123456
--  发布时间:2018/2/1 0:54:00
--  
谢谢!