以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  多个条件查询  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=46879)

--  作者:wwwzhucom
--  发布时间:2014/2/28 16:35:00
--  多个条件查询

在分页加载的时候,怎么不能按多个查询条件查询啊,不知道哪里出现了问题,请大家帮下忙找下原因,主要是不显示查询的结果;

查询按钮的代码如下:

Dim txtCXgonghao As WinForm.TextBox
txtCXgonghao=e.Form.Controls("txtCXgonghao")
Dim txtCXName As WinForm.TextBox
txtCXName=e.Form.Controls("txtCXName")
Dim cbxCXDepartment As WinForm.ComboBox
cbxCXDepartment=e.Form.Controls("cbxCXDepartment")
Dim txtCXCharing As WinForm.TextBox
txtCXCharing=e.Form.Controls("txtCXCharing")
Dim lblCount As WinForm.Label
lblCount=e.Form.Controls("lblCount")

Vars("Filter")=" "
Dim strFilter As String=Vars("Filter")

If txtCXgonghao.Value IsNot Nothing   Then
    strFilter="工号=" & txtCXgonghao.Value & " "
End If

If txtCXName.Value IsNot Nothing  Then
    If strFilter.trim.length>0 Then
        strFilter+="And" & " "
    End If
    strFilter+="姓名 like \'% " & txtCXName.Value & " %\'" & " "
End If

If cbxCXDepartment.Value IsNot Nothing Then
    If strFilter.trim.length>0 Then
        strFilter+="And" & " "
    End If
    strFilter+="部门 like \'% " & cbxCXDepartment.Value & " %\'" & " "
End If

If txtCXCharing.Value IsNot Nothing Then
    If strFilter.trim.length>0 Then
        strFilter+="And" & " "
    End If
    strFilter+="充电位=" & txtCXCharing.Value & " "
End If

Vars("Filter")=strFilter

With DataTables("人员信息")
    If Vars("Filter")<>"" Then
        .LoadFilter=Vars("Filter")
    Else
        .LoadFilter=""
    End If
    .LoadTop=35
    .LoadPage=0
    .Load()
    lblCount.Text="当前第1页/共" & .TotalPages & "页"
End With


--  作者:Bin
--  发布时间:2014/2/28 16:37:00
--  
那说明凭借的查询条件有问题  你利用MESSAGAEBOXW.show 弹出一下FIlter看看 和预想的有什么不一样就知道了
--  作者:wwwzhucom
--  发布时间:2014/2/28 16:46:00
--  
我按工号和姓名两个条件查询的,在表中确实存在这样的一条记录,但没有显示结果,下面是我用MessageBox.Show弹出的过滤条件
图片点击可在新窗口打开查看此主题相关图片如下:1.jpg
图片点击可在新窗口打开查看

--  作者:Bin
--  发布时间:2014/2/28 17:02:00
--  
有空格了    % 张三 和 %张三是不一样的
--  作者:wwwzhucom
--  发布时间:2014/3/1 8:32:00
--  

谢谢,还真是这个原因!