Foxtable(狐表)用户栏目专家坐堂 → [求助]无法在 System.Double 和 System.String 上执行“=”操作。


  共有15748人关注过本帖树形打印复制链接

主题:[求助]无法在 System.Double 和 System.String 上执行“=”操作。

帅哥哟,离线,有人找我吗?
狐狸爸爸
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251060 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/11/12 11:42:00 [显示全部帖子]

你要注意里的类型,例如:

 

flt = flt & "( 入职年份 = '" & nd.Text & "')"

 

如果入职年份是数值型,应该改为:

 

 

flt = flt & "( 入职年份 = " & nd.Text & ")"

 

其他同理。

 

 

建议看看:

http://www.foxtable.com/help/topics/1284.htm

http://www.foxtable.com/help/topics/1647.htm

 


 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251060 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/11/12 11:48:00 [显示全部帖子]

纸上不谈兵,做个例子发上说话,几分钟就可以帮你搞定。

 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251060 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/11/12 15:00:00 [显示全部帖子]

筛选的问题,代码改为:

 

Dim trv As WinForm.TreeView = e.Sender
Dim flt As String
For Each nd As WinForm.TreeNode In trv.AllNodes
    Dim pd As WinForm.TreeNode = nd.ParentNode
    Do
        If pd Is Nothing Then
            Exit Do
        End If
        If pd.Checked Then
            Continue For
        Else
            pd = pd.ParentNode
        End If
   Loop
    If nd.Checked Then
        If flt > "" Then
            flt = flt & " Or "  '注意用or而不是And
        End If
        If nd.Level = 0 Then '注意下面的条件都要用括号括起来
            flt = flt & "( 入职年份 = '" & nd.Text & "')"
        ElseIf nd.level = 1 Then
            flt = flt & "( 入职年份 = '" & nd.ParentNode.Text & "' And 部门 = '" & nd.Text & "')"
        ElseIf nd.level = 2 Then
            flt = flt & "( 入职年份 = '" & nd.parentNode.ParentNode.Text & "' And 部门 = '" & nd.ParentNode.Text & "' And 办公室 = '" & nd.Text & "')"
        ElseIf nd.level = 3
            flt = flt & "( 入职年份 = '" & nd.parentNode.parentNode.ParentNode.Text & "' And 部门 = '" & nd.parentNode.ParentNode.Text & "' And 办公室 = '" & nd.parentNode.Text & "' And 性别 = '" & nd.Text &  "')"
        End If
    End If
Next
Tables("表A").Filter = flt

 

你搞得也太复杂了,太多层的最好不要多选,单选就行:

http://www.foxtable.com/help/topics/0917.htm

 

 

 


 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251060 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/11/12 15:08:00 [显示全部帖子]

10楼给你代码了

 回到顶部