以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]2段筛选代码合并  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=193191)

--  作者:185723664
--  发布时间:2024/8/25 21:29:00
--  [求助]2段筛选代码合并
Dim t As Table = currenttable
Dim tb As String = t.cols(t.colsel).name
Dim q As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim b As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Dim s As WinForm.ComboBox = e.Form.Controls("ComboBox3")
Dim g As WinForm.ComboBox = e.Form.Controls("ComboBox4")
Dim qq As String = q.text
Dim bb As String = b.text
Dim ss As String = s.text
Dim gg As String = g.text


t.Filter = (tb & "  like \'%" & qq & "%\' and  " & tb & "  like \'%" & bb & "%\' ")
t.Filter = (tb & "  like \'%" & ss & "%\' and  " & tb & "  like \'%" & gg & "%\' ")

求助上面2段绿色代码合并,成下面黄色代码,报错如下:
从字符串“四和  like \'%1%\' and  四和  like \'%1”到类型“Long”的转换无效。
输入字符串的格式不正确。
求助修复下面黄色代码
t.Filter = (tb & "  like \'%" & qq & "%\' and  " & tb & "  like \'%" & bb & "%\' ") Or (tb & " Like \'%" & ss & "%\' and  " & tb & "  like \'%" & gg & "%\' ")
[此贴子已经被作者于2024/8/25 21:36:46编辑过]

--  作者:程兴刚
--  发布时间:2024/8/25 21:38:00
--  
t.Filter = "(" & tb & " like \'%" & qq & "%\' and " & tb & " like \'%" & bb & "%\' ) Or (" & tb & " Like \'%" & ss & "%\' and " & tb & " like \'%" & gg & "%\' )"
--  作者:185723664
--  发布时间:2024/8/25 21:41:00
--  回复:(程兴刚)t.Filter = "(" & tb & " l...
感谢程总