Foxtable(狐表)用户栏目专家坐堂 → [求助]目录树代码问题(已解决)


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

主题:[求助]目录树代码问题(已解决)

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/11/25 17:51:00 [显示全部帖子]

 

[此贴子已经被作者于2014-11-25 17:52:58编辑过]

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/11/25 18:02:00 [显示全部帖子]

Dim n3 As Integer = DataTables("工piao信息").Compute("Count(工piao编号)","iif(len(工piaoID) > 3, Substring(工piaoID, Len(工piaoID)-2, 3) = '已回收', false)") '回收数

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/11/25 19:28:00 [显示全部帖子]

类似代码

 

Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.CommandText = "SELECT DISTINCT 合同年月,客户简称,合同ID,生产ID,作业ID,工piao编号 From {工piao信息}"
dt = cmd.ExecuteReader()
Dim trv As WinForm.TreeView = Forms("工piao管理").Controls("TreeView1")
trv.BuildTree(dt,"合同年月|客户简称|合同ID|生产ID|作业ID|工piao编号","","")

trv.Nodes.Insert("作业计划合计",0)

For Each nd As WinForm.TreeNode In trv.AllNodes
    Select Case nd.Level
        Case 0
            If nd.Name = "作业计划合计" Then
                Dim n0 As Integer = DataTables("工piao信息").GetValues("作业ID").Count
                Dim n1 As Integer = DataTables("工piao信息").Compute("Count(工piaoID)") '工piao数
                Dim n2 As Integer = DataTables("工piao信息").Compute("Count(工piao编号)","Len(工piaoID) = 8") '绑定数
                Dim n3 As Integer = DataTables("工piao信息").Compute("Count(工piao编号)","iif(len(工piaoID) > 3, Substring(工piaoID, Len(工piaoID)-2, 3) = '已回收', false)") '回收数
                nd.text = nd.Name & "("& n0 &"/"& n1 &"/"& n2 &"/"& n3 &")"
            Else
                Dim filter As String = "合同年月 = '" & nd.Name & "'"
                Dim n0 As Integer = DataTables("工piao信息").GetValues("作业ID", filter).Count
                Dim n1 As Integer = DataTables("工piao信息").Compute("Count(工piaoID)", filter) '工piao数
                Dim n2 As Integer = DataTables("工piao信息").Compute("Count(工piao编号)","Len(工piaoID) = 8 and " & filter) '绑定数
                Dim n3 As Integer = DataTables("工piao信息").Compute("Count(工piao编号)","iif(len(工piaoID) > 3, Substring(工piaoID, Len(工piaoID)-2, 3) = '已回收', false) and " & filter) '回收数
                nd.text = nd.Name & "("& n0 &"/"& n1 &"/"& n2 &"/"& n3 &")"
            End If
        Case 1
            Dim ary() As String = nd.FullName.Split("\")
            Dim filter As String = "合同年月 = '" & ary(0) & "' and 客户简称 = '" & ary(1) & "'"
            Dim n0 As Integer = DataTables("工piao信息").GetValues("作业ID", filter).Count
            Dim n1 As Integer = DataTables("工piao信息").Compute("Count(工piaoID)", filter) '工piao数
            Dim n2 As Integer = DataTables("工piao信息").Compute("Count(工piao编号)","Len(工piaoID) = 8 and " & filter) '绑定数
            Dim n3 As Integer = DataTables("工piao信息").Compute("Count(工piao编号)","iif(len(工piaoID) > 3, Substring(工piaoID, Len(工piaoID)-2, 3) = '已回收', false) and " & filter) '回收数
            nd.text = nd.Name & "("& n0 &"/"& n1 &"/"& n2 &"/"& n3 &")"
           

    End Select
Next


 回到顶部