以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  【求助】模糊查询相关的问题?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=131330)

--  作者:gaojianwu
--  发布时间:2019/2/23 11:42:00
--  【求助】模糊查询相关的问题?
在一个TextBox中输入"A,B,C",怎么实现A,B,C与某一个表的的三个不同列模糊匹配?
(提示:有可能输入不止三个,例如A,B,C,D)

--  作者:有点蓝
--  发布时间:2019/2/23 12:02:00
--  
Dim txt As String = "A,B,C"
Dim cls() As String = {"第一列","第二列","第三列"}
Dim filter As String = "1=2"
Dim txts() As String = txt.Split(",")
For i As Integer = 0 To txts.Length - 1
    filter = filter & " or " & cls(i) & " like \'%" & txts(i) & "%\' "
Next
Output.Show(filter )