老师 新出来个问题了 还要麻烦您一下 谢谢您
'首先生成统计表
Dim dt As DataTable
Dim b As New GroupTableBuilder("统计表1",DataTables("商品表"))
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 splx As String = nd.DataRow("商品描述_类型")
Dim Product As String = nd.DataRow("商品描述_款式")
Select Case nd.Level
Case 0
nd.Text = nd.text & "(" & nd.DataRow("订单数") & "款)"
Case 1
nd.Text = nd.text & "(" & nd.DataRow("订单数") & "款)"
End Select
Next
trv.Nodes.Insert("显示所有行","显示所有行(" & dt.Compute("Sum(订单数)") & "款)",0)
trv.ResumeRedraw
此主题相关图片如下:12.jpg