以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  目录树生成过程中系统崩溃  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=89129)

--  作者:xujie80
--  发布时间:2016/8/16 9:21:00
--  目录树生成过程中系统崩溃

\'生成统计表

Dim dt As DataTable

Dim b As New sqlGroupTableBuilder("total","员工家庭")

b.ConnectionName = "HaiHeBase"

b.filter = ""

b.Groups.AddDef("房产现状")

b.Groups.AddDef("部门村居")

b.Groups.AddDef("所站办组")

b.Groups.AddDef("户主姓名")

b.Totals.AddDef("房产现状",AggregateEnum.count,"结构") \'根据客户列来统计结构数

dt = b.Build(false) \'如果参数设置为False,生成一个临时表,不在主界面显示

\'然后根据统计表生成目录树

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

Dim t As WinForm.Table = e.Form.Controls("table1")

t.BackColor = Color.Lightblue

DataTables("安全_table1").SysStyles("EmptyArea").BackColor = Color.lightblue


上述代码如果不执行黄底部分,3万条数据,虽然要十几秒,还可以接受,但加入黄底部分,直接停止响应!查了一下,语句没有问题,请高人指点。


--  作者:Hyphen
--  发布时间:2016/8/16 11:05:00
--  
上例子测试,不然还是做成分页显示吧