以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  求助,查询表数据  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=150687)

--  作者:BG小白
--  发布时间:2020/6/5 3:07:00
--  求助,查询表数据
Dim dt1 As DataTable = DataTables("GB")
Dim dt2 As DataTable = DataTables("SPCKB")
Dim dt3 As DataTable = DataTables("DBB")
dt3.DataRows.Clear
For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "SPDM = \'" & dr("SPDM") & "\' and GG1DM = \'" & dr("GG1DM") & "\' and GG2DM = \'" & dr("GG2DM") &""
    Dim fdr As DataRow = dt2.Find(filter)
    If fdr Is Nothing Then
        Dim ndr As DataRow = dt3.AddNew
        ndr("SPDM") = dr("SPDM")
        ndr("GG1DM") = dr("GG1DM")
        ndr("GG2DM") = dr("GG2DM")
        ndr("SL") = dr("SL")
    End If
Next

这段代码哪里出了问题,就是对比表A和表B,然后显示在临时表C中
图片点击可在新窗口打开查看此主题相关图片如下:22.png
图片点击可在新窗口打开查看

--  作者:有点蓝
--  发布时间:2020/6/5 9:05:00
--  
Dim filter As String = "SPDM = \'" & dr("SPDM") & "\' and GG1DM = \'" & dr("GG1DM") & "\' and GG2DM = \'" & dr("GG2DM") & "\'"

少一个单引号