以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]条件加载数据  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=75008)

--  作者:ehomecd
--  发布时间:2015/9/24 13:46:00
--  [求助]条件加载数据
根据条件加载数据,无论前边是什么条件,都不加载已经离开的学生数据,中间红色的代码有问题,这个表达式应该如何写?

Dim filter As String
Dim sts() As String = {"学生编号","姓名","性别","年级","班级","团队","服务类型"}
For Each st As String In sts
    Dim val As String = e.Form.Controls(st).value
    If val > "" Then
        val = val.Replace("*","[*]")
        If filter = "" Then
            filter = st & " like \'%" & val & "%\'"
        Else
            filter = filter & " and " & st & " like \'%" & val & "%\'"
        End If
    End If
Next

filter = filter & " And "学生状态 <> \'离开\'"

DataTables("学生信息").LoadFilter = filter
DataTables("学生信息").Load()

--  作者:czy
--  发布时间:2015/9/24 15:08:00
--  
filter = filter & " And 学生状态 <> \'离开\'"