以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- treeview效率 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=89009) |
-- 作者:xujie80 -- 发布时间:2016/8/13 14:24:00 -- treeview效率 以下代码与帮助文件中的代码完全一致,数据有3万多行,加载窗口要3分多钟,求大师指点。 Dim t As WinForm.Table = e.Form.Controls("水") t.BackColor
= Color.LightCyan DataTables("员工家庭").SysStyles("EmptyArea").BackColor = Color.lightcyan \'生成统计表 Dim dt As DataTable Dim b As New sqlGroupTableBuilder("total","员工家庭") b.ConnectionName
= "HaiHeBase" b.Groups.AddDef("饮用水") b.Groups.AddDef("部门村居") b.Groups.AddDef("所站办组") b.Groups.AddDef("户主姓名") b.Totals.AddDef("饮用水",AggregateEnum.count,"结构") \'根据客户列来统计结构数 dt = b.Build \'参数设置为False,生成一个临时表,不在主界面显示 msgbox(1) \'然后根据统计表生成目录树 Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1") trv.BuildTree(dt,"饮用水|部门村居|所站办组|户主姓名") trv.StopRedraw For Each nd As WinForm.TreeNode In trv.AllNodes Dim bm As String = nd.DataRow("部门村居") Dim sz As String = nd.DataRow("所站办组") Dim aq As String = nd.DataRow("饮用水") Dim xm As String = nd.DataRow("户主姓名") Select Case nd.Level Case 0 nd.Text = nd.text & "("
& dt.Compute("count(结构)","饮用水 = \'" & aq & "\'")
& "户)" Case 1 nd.Text = nd.text & "("
& dt.Compute("count(结构)","饮用水 = \'" & aq & "\' and 部门村居 = \'"
& bm & "\'") & "户)" Case 2 nd.Text = nd.text & "("
& dt.Compute("count(结构)","饮用水 = \'" & aq & "\' and 部门村居 = \'"
& bm & "\' And 所站办组 = \'" & sz & "\'")
& "户)" Case 3 nd.Text = nd.text & "("
& dt.Compute("count(结构)","饮用水 = \'" & aq & "\' and 部门村居 = \'"
& bm & "\' And 所站办组 = \'" & sz & "\' And 户主姓名 = \'" & xm & "\'")
& "户)" End Select Next trv.Nodes.Insert("全镇户数","全镇户数("
& dt.Compute("count(结构)")
& "户)",0) trv.ResumeRedraw |
-- 作者:Hyphen -- 发布时间:2016/8/13 15:09:00 -- 数据多没有办法的,要么做成分页加载 |