以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]目录树统计提示找不到列  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=191217)

--  作者:wudishaoshuai
--  发布时间:2024/4/2 11:59:00
--  [求助]目录树统计提示找不到列
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(gt, "年|月|日|分类|部件")
trv.StopRedraw
For Each nd As WinForm.TreeNode In trv.AllNodes
    Dim Year As Integer = nd.DataRow("年")
    Dim Month As Integer = nd.DataRow("月")
    Dim Day As Integer = nd.DataRow("日")
    Dim type As String = nd.DataRow("分类")
    Dim component As String = nd.DataRow("部件")
    Select Case nd.Level
        Case 0
            nd.Text = nd.text & "年(" & gt.Compute("Sum(数量)", "年 = " & Year) & "个)"
        Case 1
            nd.Text = nd.text & "月(" & gt.Compute("Sum(数量)", "年 = " & Year & " And 月 = " & Month) & "个)"
        Case 2
            nd.Text = nd.text & "日(" & gt.Compute("Sum(数量)", "年 = " & Year & " And 月 = " & Month & " And 日 = " & Day) & "个)"
        Case 3
            nd.Text = nd.text & "日(" & gt.Compute("Sum(数量)", "年 = " & Year & " And 月 = " & Month & " And 日 = " & Day & " And 分类 = " & type) & "个)"
        Case 4
            nd.Text = nd.text & "(" & gt.Compute("Sum(数量)", "年 = " & Year & " And 月 = " & Month & " And 日 = " & Day) & "个)" 
    End Select
Next
trv.Nodes.Insert("[显示所有行]", "显示所有行(" & Val(gt.Compute("Sum(数量)")) & "个)", 0)
trv.ResumeRedraw

代码如上,点击case3的时候提示找不到列,前面1,2都可以,是case3的后面的条件写错了吗

--  作者:有点蓝
--  发布时间:2024/4/2 13:33:00
--  
参考:http://www.foxtable.com/webhelp/topics/1284.htm

Case 3
            nd.Text = nd.text & "日(" & gt.Compute("Sum(数量)", "年 = " & Year & " And 月 = " & Month & " And 日 = " & Day & " And 分类 = \'" & type & "\'") & "个)"