以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  datatables load出错  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=122764)

--  作者:yuweijie
--  发布时间:2018/8/1 20:39:00
--  datatables load出错
下面代码只要选了日期,load就出错。弹出窗口正常
.NET Framework 版本:2.0.50727.8762
Foxtable 版本:2018.3.9.1
错误所在事件:加载[灭火器表]失败!
详细错误信息:
第 1 行: \'#\' 附近有语法错误。




Dim gly As WinForm.ComboBox = e.Form.Controls("管理员")
Dim sd As WinForm.DateTimePicker = e.Form.Controls("开始日期")
Dim ed As WinForm.DateTimePicker = e.Form.Controls("截止日期")

If bm.Value <> "全部" Then
    filter = "编码 like \'%" & bm.value & "%\'"
End If

If xh.Value <> "全部" Then
    If filter > "" Then
        filter = filter & " and 型号 like \'%" & xh.value & "%\'"
    Else
        filter = "型号 like \'%" & xh.value & "%\'"
    End If
End If

If gly.Value <> "全部" Then
    If filter > "" Then
        filter = filter & " and 管理员 like \'%" & gly.value & "%\'"
    Else
        filter = "管理员 like \'%" & gly.value & "%\'"
    End If
End If
If sd.value IsNot Nothing Then
    If filter > "" Then
        filter = filter & " and 充装预警 >= #" & sd.value & "#"
    Else
        filter = "充装预警 >= #" & sd.value & "#"
    End If
End If

If ed.value IsNot Nothing Then
    If filter > "" Then
        filter = filter & " and 充装预警 <= #" & ed.value & "#"
    Else
        filter = "充装预警 <= #" & ed.value & "#"
    End If
End If
DataTables("灭火器表").LoadFilter = filter
MessageBox.Show(filter)
DataTables("灭火器表").Load

--  作者:有点甜
--  发布时间:2018/8/1 20:46:00
--  

如果是sqlserver数据库,把#改成单引号\'

 

http://www.foxtable.com/webhelp/scr/2668.htm