以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]SQL语句  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=118448)

--  作者:狐说八道
--  发布时间:2018/5/3 10:01:00
--  [求助]SQL语句
Dim filter1 As String = "[入职日期] < \'" & Date1 & "\'"
Dim filter2 As String = "[离职日期] > \'" & Date1 & "\' or [离职日期] is null"

Dim cmd As New SQLCommand
cmd.C
cmd.CommandText = "Selec t * fr om (Selec t * fr om ov_emp where " & filter1 & ") where " & filter2
Dim dt As DataTable = cmd.ExecuteReader

提示:关键字 \'where\' 附近有语法错误。

麻烦老师帮忙看看错在哪? 谢谢


--  作者:有点甜
--  发布时间:2018/5/3 10:02:00
--  
cmd.CommandText = "Select * from (Selec t * from ov_emp where " & filter1 & ") as a where " & filter2