以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]Find 与SQLFind 结果不一致  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=105859)

--  作者:浙江仔
--  发布时间:2017/8/28 10:29:00
--  [求助]Find 与SQLFind 结果不一致
Dim i1 As Integer =10

Dim fdr As DataRow = DataTables("Train_info").sqlFind("ID_CARD =  \'" & Tables("tb_pxbm").Rows(i1)("papernum") & "\' and Train_Class =  \'管理人员\' and county = \'" & Tables("tb_pxbm").Rows(i1)("county") & "\' and is_meeting <> true  ","Train_Date desc")

If fdr IsNot Nothing Then
            messagebox.show(fdr("bmID"))
Else
messagebox.show("1")

End If

Dim fd As  DataRow = DataTables("Train_info").Find("ID_CARD =  \'" & Tables("tb_pxbm").Rows(i1)("papernum") & "\' and Train_Class =  \'管理人员\' and county = \'" & Tables("tb_pxbm").Rows(i1)("county") & "\' and is_meeting <> true  ","Train_Date desc")

If fd IsNot Nothing Then
            messagebox.show(fd("bmID"))
Else
messagebox.show("2")
End If

同样的条件,Find 与SQLFind 查询的结果是不一样的
SQLFind 跑到了messagebox.show("1")
find 就正常显示messagebox.show(fd("bmID"))


--  作者:浙江仔
--  发布时间:2017/8/28 10:31:00
--  
我发现问题出在逻辑列
改成这个is_meeting <> 1 就一致了

--  作者:有点甜
--  发布时间:2017/8/28 10:33:00
--  

1、你的数据保存了没有?sqlfind是查询已经保存的数据;

 

2、你的查询条件的列,有没有表达式列?表达式列不能直接查。

 

3、逐个删除条件测试是哪里出错。


--  作者:浙江仔
--  发布时间:2017/8/28 10:34:00
--  
逻辑列的问题
--  作者:有点甜
--  发布时间:2017/8/28 10:46:00
--  
以下是引用浙江仔在2017/8/28 10:34:00的发言:
逻辑列的问题

 

那就改成 and is_meeting = False 或者 and is_meeting = 0