Foxtable(狐表)用户栏目专家坐堂 → [求助]关于模糊筛选


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

主题:[求助]关于模糊筛选

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/10/16 19:11:00 [显示全部帖子]

 不能这样,除非加空格 89 M

 

 Dim tnames() As String = { "Table1", "Table2"}
With e.Form
    If e.sender.text <> ""Then
        For Each tname As String In tnames
            Dim dst As Table = Tables(tname)
            Dim txb1 As WinForm.TextBox = .Controls("TextBox1")
            Dim filter As String = "1=2"
            For Each dc As DataCol In dst.DataTable.DataCols
                For Each tx As String In txb1.Text
                    filter &= " or convert(" & dc.Name & ",'System.String') like '%" & tx & "%'"
                Next
            Next
           
            dst.Filter = filter
        Next
    End If
End With


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/10/16 19:16:00 [显示全部帖子]

 写错了。

 

Dim tnames() As String = { "Table1", "Table2"}
With e.Form
    If e.sender.text <> ""Then
        For Each tname As String In tnames
            Dim dst As Table = Tables(tname)
            Dim txb1 As WinForm.TextBox = .Controls("TextBox1")
            Dim filter As String = "1=2"
            For Each dc As DataCol In dst.DataTable.DataCols
                filter &= " or "
                Dim ary() As String = txb1.Text.Split(" ")
                For i As Integer = 0 To ary.Length - 2
                    filter &= " convert(" & dc.Name & ",'System.String') like '%" & ary(i) & "%'"
                    filter &= " and "
                Next
                filter &= " convert(" & dc.Name & ",'System.String') like '%" & ary(ary.length-1) & "%'"
            Next
           
            dst.Filter = filter
        Next
    End If
End With


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/10/16 19:39:00 [显示全部帖子]

 例子发上来。

 回到顶部