Foxtable(狐表)用户栏目专家坐堂 → [求助]模糊查询表中不出现查询内容


  共有9165人关注过本帖树形打印复制链接

主题:[求助]模糊查询表中不出现查询内容

帅哥哟,离线,有人找我吗?
whtjtx
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:53 积分:528 威望:0 精华:0 注册:2012/1/20 14:52:00
[求助]模糊查询表中不出现查询内容  发帖心情 Post By:2012/2/16 1:19:00 [只看该作者]

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目4.table

参照网上的模糊查询帮助,新建了个模糊查询窗口(窗口2),在输入框中输入内容,表中不显示文字,但是能够筛选出符合条件的行数,就是没显示文字,大家看看这段代码错在哪里?

Dim t As Table =Tables("窗口2_Table1")
Dim st,ls ,py,Lm,str,Lss As String
Dim Ts As String() = {"第一列","第二列","第三列","第四列"}
Dim drs As New List(of DataRow)

st = e.sender.Text.ToUpper
drs = DataTables("表A").Select("第一列 > ''")
If drs.count > 0 Then
    If st IsNot Nothing Then
        For Each Lm In Ts
            For Each dr As DataRow In DataTables("表A").DataRows
                py = GetPY(dr(Lm),True)
                If dr(Lm).IndexOf(st)> -1 OrElse py.IndexOf(st) > -1 Then
                    If Ls Is Nothing Then
                        Ls = dr("_Identify")
                    Else
                        If Ls.IndexOf(dr("_Identify")) = -1 Then
                            ls+= "," &  dr("_Identify")
                        End If
                    End If
                   
                    If Lss Is Nothing Then
                        Lss = dr(Lm)
                    Else
                        If Lss.IndexOf(dr(Lm)) = -1 Then
                            Lss+ = "|" & dr(Lm)
                        End If
                    End If
                End If
            Next
        Next
        If ls IsNot Nothing Then
            Ls ="[_Identify] In(" & Ls & ")"
            Ls="select 第一列,第二列 ,第三列,第四列 from{表A} where " & Ls
            t.Fill(Ls,True)
            e.sender.ComboList = Lss
        End If
    End If
End If


 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251060 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/2/16 7:52:00 [只看该作者]

没有看懂你的问题,不过既然数据都加载了,用筛选就行了,何必用Fill,这样开销很大,所以最后一段应该改为:

 

If ls IsNot Nothing Then
    Ls ="[_Identify] In(" & Ls & ")"

     Tables("窗口1").Filter = ls
    e.sender.ComboList = Lss
End If


 回到顶部