以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  DataTable.LoadFilter加载  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=60068)

--  作者:sdscen
--  发布时间:2014/11/17 20:54:00
--  DataTable.LoadFilter加载
Dim nr As WinForm.TextBox = e.Form.Controls("查询内容")
Dim xzl As WinForm.ComboBox = e.Form.Controls("选择列")
Dim je As WinForm.TextBox = e.Form.Controls("金额")
Dim d As WinForm.Label = e.Form.Controls("Label1")
Dim f As Table = Tables("主窗口_子窗体")
Dim b As Table = Tables("主窗口_子窗口2")
Dim shcx As WinForm.ComboBox = e.Form.Controls("审核查询")
If xzl.Value <> "全部" Then
    If f.ColS(""& xzl.Value &"").IsDate Then
        Dim rqgs As Date = nr.Value
        If rqgs <> Nothing Then
            If shcx.Value = "未审核" Then
                f.DataTable.LoadFilter = "" & xzl.Value & " = #" & rqgs & "# And 审核状态 = False "
            Else If shcx.Value = "已审核" Then
                f.DataTable.LoadFilter = "" & xzl.Value & " = #" & rqgs & "# And 审核状态 = True "
            Else If shcx.Value = "全部" Then
                f.DataTable.LoadFilter = "" & xzl.Value & " = #" & rqgs & "# "
            End If
        Else If rqgs = Nothing Then
            If shcx.Value = "未审核" Then
                f.DataTable.LoadFilter = "审核状态 = False "
            Else If shcx.Value = "已审核" Then
                f.DataTable.LoadFilter = "审核状态 = True "
            Else If shcx.Value = "全部" Then
                f.DataTable.LoadFilter = ""
            End If
        End If
    Else If f.ColS(""& xzl.Value &"").IsNumeric Then
        Dim szgs As Double = nr.Value
        If szgs <> Nothing Then
            If shcx.Value = "未审核" Then
                f.DataTable.LoadFilter = "" & xzl.Value & " = " & szgs & " And 审核状态 = False "
            Else If shcx.Value = "已审核" Then
                f.DataTable.LoadFilter = "" & xzl.Value & " = " & szgs & " And 审核状态 = True "
            Else If shcx.Value = "全部" Then
                f.DataTable.LoadFilter = "" & xzl.Value & " = " & szgs & ""
            End If
        Else If szgs = Nothing Then
            If shcx.Value = "未审核" Then
                f.DataTable.LoadFilter = " 审核状态 = False "
            Else If shcx.Value = "已审核" Then
                f.DataTable.LoadFilter = " 审核状态 = True "
            Else If shcx.Value = "全部" Then
                f.DataTable.LoadFilter = ""
            End If
        End If
    Else
        If nr.Value = "" Then
            If shcx.Value = "未审核" Then
                f.DataTable.LoadFilter = "审核状态 = False "
            Else If shcx.Value = "已审核" Then
                f.DataTable.LoadFilter = "审核状态 = True "
            Else If shcx.Value = "全部" Then
                f.DataTable.LoadFilter = ""
            End If
        Else
            If shcx.Value = "未审核" Then
                f.DataTable.LoadFilter = "" & xzl.Value & " like \'*" & nr.Value & "*\' And 审核状态 = False "
            Else If shcx.Value = "已审核" Then
                f.DataTable.LoadFilter = "" & xzl.Value & " like \'*" & nr.Value & "*\' And 审核状态 = True "
            Else If shcx.Value = "全部" Then
                f.DataTable.LoadFilter = "" & xzl.Value & " like \'*" & nr.Value & "*\'"
            End If
        End If
    End If
Else If xzl.Value = "全部" Then
    If shcx.Value = "全部" Then
        f.DataTable.LoadFilter = ""
    Else If  shcx.Value = "已审核" Then
        f.DataTable.LoadFilter = " 审核状态 = true "
    Else If shcx.Value = "未审核" Then
        f.DataTable.LoadFilter = " 审核状态 = false "
    End If
    Tables("主窗口_子窗体").AutoSizeCols()
    je.Text = f.Compute("sum([金额])")
End If
f.DataTable.Load

以上红字部分代码执行时查不到数据(实际数据有,数据类型为字符型),其他部分全部都正常,请高手指点下是什么问题

--  作者:有点甜
--  发布时间:2014/11/17 20:56:00
--  

 like 不能用 * 要用 %

 

 f.DataTable.LoadFilter = "" & xzl.Value & " like \'%" & nr.Value & "%\' And 审核状态 = False "