以文本方式查看主题

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

--  作者:xjc620
--  发布时间:2014/12/10 16:41:00
--  多表查询
Dim filter As String = "1=2"
    For Each dc As Col In CurrentTable.Cols
        filter &= " or convert(" & dc.Name & ",\'System.String\') like \'%" & e.Form.Controls("TextBox1").Text & "%\'"
    Next
    CurrentTable.Filter = filter


因为窗口中有多个表怎么换成同时查询多个表,这样换为什么不对,应该怎么写啊
Dim filter As String = "1=2"
    For Each dc As Col In Tables("北斗安装","北斗续费").Cols
        filter &= " or convert(" & dc.Name & ",\'System.String\') like \'%" & e.Form.Controls("TextBox1").Text & "%\'"
    Next
    Tables("北斗安装","北斗续费").Filter = filter

--  作者:Bin
--  发布时间:2014/12/10 16:43:00
--  
分开了筛选,分开来遍历.
--  作者:有点甜
--  发布时间:2014/12/10 17:54:00
--  
Dim tns() As String = {"表A", "表B"}
For Each tn As String In tns
Dim filter As String = "1=2"
    For Each dc As Col In CurrentTable.Cols
        filter &= " or convert(" & dc.Name & ",\'System.String\') like \'%" & e.Form.Controls("TextBox1").Text & "%\'"
    Next
    Tables(tn).Filter = filter
Next