以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]字符串模式“%[%”无效。  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=120634)

--  作者:Fox86
--  发布时间:2018/6/21 8:12:00
--  [求助]字符串模式“%[%”无效。

老师好,以下语句输入符号“[”报错,而输入“]”不报错,该怎么解决?试了其他字符暂时还没有发现,会不会有还未测试出来的?

Dim txt As String = e.Form.Controls("TextBox1").Text
Dim wbl As WinForm.Table = e.Form.Controls("Table1")
Dim tbl As Table = wbl.Table
If txt = "" Then
    tbl.Filter = ""
Else
    txt = "\'%" & txt.Replace("*","[*]").Replace("%","[%]") & "%\'"
    tbl.Filter = "编号 Like " & txt & " Or 名称 Like " & txt & " Or 型号 Like " & txt & " Or 描述 Like " & txt
End If

 


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20180621075630.png
图片点击可在新窗口打开查看

--  作者:有点甜
--  发布时间:2018/6/21 8:50:00
--  
txt = "\'%" & txt.replace("[", "#").replace("]", "@").replace("#", "[[]").replace("@", "[]]").Replace("*","[*]").Replace("%","[%]") & "%\'"
--  作者:Fox86
--  发布时间:2018/6/21 9:02:00
--  可以了
谢谢有点甜老师!