以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  Cannot perform '=' operation on System.Int32 and System.String.涵义  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=65672)

--  作者:czy66ds
--  发布时间:2015/3/20 11:47:00
--  Cannot perform '=' operation on System.Int32 and System.String.涵义
运行错误:
Cannot perform \'=\' operation on System.Int32 and System.String.
是何涵义?

--  作者:Bin
--  发布时间:2015/3/20 12:01:00
--  
你的代码或者表达式有问题.

字符串类型不可以和数值类型 做等于比较

--  作者:有点甜
--  发布时间:2015/3/20 12:06:00
--  
 贴出导致出错的代码
--  作者:Creast
--  发布时间:2018/5/4 15:34:00
--  Cannot perform '>=' operation on System.String and System.Int32.

我也遇到这个问题了

Dim lb As WinForm.ComboBox = e.Form.Controls("类别")
Dim sycl As WinForm.ComboBox = e.Form.Controls("使用策略")
Dim ggxx As WinForm.TextBox = e.Form.Controls("规格")\'规格下限
Dim ggsx As WinForm.TextBox = e.Form.Controls("上限") \'规格上限
Dim gz As WinForm.RadioButton = e.Form.Controls("公制")
Dim yz  As WinForm.RadioButton = e.Form.Controls("英制")
Dim gg As Single
Dim FilterA As String
Dim syclv As String
If ggxx.Text="下限" Then ggxx.text=Nothing
If ggsx.Text="上限" Then ggsx.text=Nothing
Dim lbv As String

If lb.text="" Then
    lbv="*"
    filterA="TCatg Like \'*\'"
Else
    lbv=lb.Text
    filtera="TCatg like \'" &  lb.text & "\'"
End If
If gz.Checked Then
    filtera=filtera & " and MMIN =true"
ElseIf yz.Checked Then
    filtera=filtera & "And MMIN=false"
End If
If sycl.text<>"全部" Then
    If sycl.Text <>"" Then
        filtera=filtera & " and RMLC =\'"  & sycl.Text & "\'"
    End If
End If

If IsNumeric(ggxx.value) Then   \'规格下限为数值型
    MessageBox.Show("暂停1:  " & ggxx.value & ":" & ggsx.Value)
    If ggxx.value>=0 Then
        If  ggsx.value>0 Then
            MessageBox.Show("暂停2")
            If ggxx.value>ggsx.value Then
                MessageBox.Show("暂停3")
                gg=ggxx.value
                ggxx.value=ggsx.value  \'重置上下限
                ggsx.value=gg
            End If
            Dim xx As Single=ggxx.value
            Dim sx As Single=ggsx.value
            filtera=filtera & " and [NorDiameter] >=" & xx & " And  [NorDiameter] <= " & sx
            MessageBox.Show("暂停5")
        ElseIf ggsx.value Is Nothing Then
Dim xx As Single = ggxx.value
            MessageBox.Show("暂停4")
            filtera=filtera & " and NorDiameter=" & xx
        End If
    End If
ElseIf ggxx.text  Is Nothing Then  \'字符型,如丝锥等
    MessageBox.Show("暂停6B")
    filtera=filtera & " and NorDiameter like \'*" & ggxx.Text & "*\'"
End If
MessageBox.Show("暂停7" & FilterA)
DataTables("ToolingTechList").AllowEdit=True
Tables("ToolingTechList").Filter=filterA

 

执行到filter时出现

 图片点击可在新窗口打开查看

[此贴子已经被作者于2018/5/4 15:34:54编辑过]

--  作者:Creast
--  发布时间:2018/5/4 15:36:00
--  

图片点击可在新窗口打开查看此主题相关图片如下:2018-05-04 15_33_13-窗口设计器.jpg
图片点击可在新窗口打开查看

--  作者:有点甜
--  发布时间:2018/5/4 15:47:00
--  

加入msgbox定位一下出错的位置

 

http://www.foxtable.com/webhelp/scr/1485.htm