以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]无法在 System.Boolean 和 System.String 上执行“Like”操作。  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=188208)

--  作者:moseser
--  发布时间:2023/9/7 15:21:00
--  [求助]无法在 System.Boolean 和 System.String 上执行“Like”操作。
我编写了一个筛选的函数,但提示 无法在 System.Boolean 和 System.String 上执行“Like”操作。

st1 代表筛选的列   st2 代表要筛选的内容,如果用空格隔开,代表,多条件筛选
请老师帮忙看下,那么有问题,谢谢

Dim t As Table = CurrentTable
Dim st1 As String = "项目名称,项目特征"
Dim cls() As String = st1.Split(",")

Dim st2 As String = "C30 砼"
Dim txts() As String = st2.Split(" ")

Dim filter As String = " 1 = 1 "
Dim Str1 As String

For m As Integer = 0 To txts.Length - 1
    Dim txt As String = txts(m)
    txt = "\'%" & txt & "%\'"
    For i As Integer = 0 To cls.Length - 1
        cls(i) = cls(i) & " Like " & txt
    Next
    Str1 = String.Join(" or ", cls)
    txts(m) = "( " & str1 & ")"
Next
Dim Nf As String = String.Join(" and  " , txts)
t.Filter = filter & " and " & nf









--  作者:有点蓝
--  发布时间:2023/9/7 15:29:00
--  
弹出结果看看
msgbox(filter & " and " & nf)