Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:TextChanged

1楼
1234567 发表于:2024/9/26 9:32:00

.NET Framework 版本:4.0.30319.1
Foxtable 版本:2022.8.18.1
错误所在事件:
详细错误信息:
Cannot perform 'Like' operation on System.String and System.Int32.

 

Dim Filter As String
Dim txt As String = e.Form.Controls("TextBox1").Text
If txt = "" Then
   Filter = ""
Else
   txt = "'%" & txt & "%'"
Filter = "(车台产品编号 like " & txt & "Or 加工单位 Like " & txt & ")"
End If
''msgbox(Filter)


Dim txt2 As String = e.Form.Controls("TextBox2").Text
If txt2 > "" Then
   If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "(车台产品编号 like " & txt2 & "Or 加工单位 Like " & txt2 & ")"
End If

'msgbox(Filter)

 


If Filter > "" Then
    Tables("模具清单_Table03").Filter = Filter
End If

2楼
cd_tdh 发表于:2024/9/26 9:59:00
这个意思?
Dim Filter As String
With e.Form.Controls("TextBox1")
    If .Value <> Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "车台产品编号 like '%" & .Value & "%'"
    End If
End With
With e.Form.Controls("TextBox2")
    If .Value <> Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "加工单位 like '%" & .Value & "%'"
    End If
End With
If Filter > "" Then
    Tables("表A").Filter = Filter
End If
[此贴子已经被作者于2024/9/26 9:59:20编辑过]
3楼
有点蓝 发表于:2024/9/26 10:21:00
字符列才能使用like,整数列要做转换。

Filter = Filter & "convert(车台产品编号,'System.String') like '%" & .Value & "%'"

另外,多个控件条件查询建议使用这种用法:http://www.foxtable.com/webhelp/topics/1058.htm
4楼
1234567 发表于:2024/9/26 10:21:00

原因找到了。

Dim Filter As String
Dim txt As String = e.Form.Controls("TextBox1").Text
txt = "'%" & txt & "%'"
If txt > "" Then
    If Filter > "" Then
        Filter = Filter & " And "
    End If
    Filter = "(车台产品编号 like " & txt & "Or 加工单位 Like " & txt & ")"
        msgbox(Filter)
End If

Dim txt2 As String = e.Form.Controls("TextBox2").Text
txt2 = "'%" & txt2 & "%'"   少了这行代码
If txt2 > "" Then
    If Filter > "" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "(车台产品编号 like " & txt2 & "Or 加工单位 Like " & txt2 & ")"
    msgbox(Filter)


End If

If Filter > "" Then
    Tables("模具清单_Table03").Filter = Filter
End If

共4 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .01880 s, 2 queries.