以文本方式查看主题

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

--  作者:rightinfo2014
--  发布时间:2015/8/29 20:10:00
--  [求助]无法在 System.Single 和 System.String 上执行“Like”操作-已解决

报错,如下图,求助?

谢谢各位大咖图片点击可在新窗口打开查看

 预览时,如在dropdownbox试输入“a”,即出现以下报错,


图片点击可在新窗口打开查看此主题相关图片如下:无法在 system.single 和 system.string 上执行
图片点击可在新窗口打开查看

 

代码如下:

 

模糊查询客户-dropdownbox之TextChanged事件代码设置为:

 

Dim drp As WinForm.DropDownBox = e.sender
If drp.DroppedDown Then \'如果下拉窗口已经打开
    Dim tbl As Table = Tables("下拉列表_Table1")
    If drp.Text = "" Then \'如果内容为空
        tbl.Filter = "" \'显示所有客户
    Else \'否则根据输入内容进行模糊筛选
        Dim txt As String = "\'%" & drp.Text & "%\'"
        tbl.Filter = "客户 Like " & txt & " Or Company Like " & txt & " Or 主营业务 Like " & txt & _
        " Or 全称 Like " & txt & " Or fullCompany Like " & txt & " Or 客户类型 Like " & txt & _
        " Or 销售策略 Like " & txt & " Or 客户信用 Like " & txt & " Or 交货条件 Like " & txt & _
        " Or 付款条件 Like " & txt & " Or 付款方式 Like " & txt & " Or 联系人 Like " & txt & _
        " Or Name Like " & txt & " Or 联系固话1 Like " & txt & " Or 联系固话2 Like " & txt & _
        " Or 联系固话3 Like " & txt & " Or 联系手机1 Like " & txt & " Or 联系手机2 Like " & txt & _
        " Or 联系手机3 Like " & txt & " Or 联系人职务 Like " & txt & " Or Fax1 Like " & txt & _
        " Or 联系Email1 Like " & txt & " Or 联系Email2 Like " & txt & " Or 在线联系1 Like " & txt & _
        " Or 公司负责人 Like " & txt & " Or 负责人职务 Like " & txt & " Or Manager Like " & txt & _
        " Or ManagerPost Like " & txt & " Or 负责人固话1 Like " & txt & " Or 负责人固话2 Like " & txt & _
        " Or 负责人手机1 Like " & txt & " Or 负责人手机2 Like " & txt & " Or 负责人eMail1 Like " & txt & _
        " Or 负责人eMail2 Like " & txt & " Or 公司总机1 Like " & txt & " Or 办公地址 Like " & txt & _
        " Or OfficeAddress Like " & txt & " Or 公司地址 Like " & txt & " Or CompanyAddress Like " & txt & _
        " Or 法人代表 Like " & txt & " Or 结算账户名1 Like " & txt & " Or 开户币种1 Like " & txt & _
        " Or 开户机构1 Like " & txt & " Or 开户机构地址1 Like " & txt & " Or 结算账户名2 Like " & txt & _
        " Or 开户币种2 Like " & txt & " Or 开户机构2 Like " & txt & " Or 开户机构地址2 Like " & txt & _
        " Or 结算帐户名3 Like " & txt & " Or 开户币种3 Like " & txt & " Or 开户机构3 Like " & txt & _
        " Or 开户机构地址3 Like " & txt & " Or 状态 Like " & txt & " Or 建档时间 Like " & txt & _
        " Or 建档人 Like " & txt & " Or 修订时间 Like " & txt & " Or 修订摘要 Like " & txt & _
        " Or 修订人 Like " & txt & " Or 业务员 Like " & txt & " Or 结算账号3 Like " & txt & _
        " Or 结算账号2 Like " & txt & " Or 结算账号1 Like " & txt & " Or 会员 Like " & txt & _
        " Or 在线联系2 Like " & txt & " Or Fax2 Like " & txt & " Or VendorNum Like " & txt & _
        " Or VendorAddr Like " & txt & " Or Clerk Like " & txt & " Or 内销外销 Like " & txt
       
    End If
End If

[此贴子已经被作者于2015/8/30 8:40:50编辑过]

--  作者:有点蓝
--  发布时间:2015/8/29 20:14:00
--  
贴出代码看看
--  作者:rightinfo2014
--  发布时间:2015/8/30 8:40:00
--  

多谢有点蓝,问题找到并解决了。图片点击可在新窗口打开查看

原来,字段“客户信用”是Single类型,我把它从filter中删除,问题就解决了。


--  作者:大红袍
--  发布时间:2015/8/30 9:45:00
--  

如果不是字符类型的like查询,就这样写

 

"Convert(客户信用, \'System.String\') like " & txt


--  作者:rightinfo2014
--  发布时间:2015/8/30 22:34:00
--  
学习了。在此谢过袍大师图片点击可在新窗口打开查看图片点击可在新窗口打开查看