-- 作者:qwz405
-- 发布时间:2015/10/14 16:59:00
-- [求助]出现重复目录
代码如下,求老师帮忙。
Dim dt As DataTable Dim b As New SQLGroupTableBuilder("统计表1","商品资料") \'首先生成统计表 b.C**** \'连接的数据库 b.Filter = "停用 = 0" b.Groups.AddDef("仓库") b.Groups.AddDef("类别") b.Totals.AddDef("商品编码",AggregateEnum.Count,"商品编码") \'根据商品编码列来统计记录数,也就是商品数 b.Build() dt = DataTables("统计表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 ck As String = nd.DataRow("仓库") Dim lb As String = nd.DataRow("类别") Select Case nd.Level Case 0 nd.Text = nd.text & "(" & dt.Compute("Sum(商品编码)","仓库 = \'" & ck & "\'" ) & "项)" Case 1 nd.Text = nd.text & "(" & dt.Compute("Sum(商品编码)","仓库 = \'" & ck & "\' And 类别 = \'" & lb & "\'" ) & "项)" End Select Next trv.Nodes.Insert("加载所有行","加载所有行(" & dt.Compute("Sum(商品编码)") & "项)",0) trv.ResumeRedraw
此主题相关图片如下:111.jpg
[此贴子已经被作者于2015/10/14 17:00:59编辑过]
|
-- 作者:大红袍
-- 发布时间:2015/10/14 17:02:00
--
排序会影响生成的
trv.BuildTree(dt,"仓库|类别",,"仓库,类别,商品编码") \'然后根据统计表生成目录树
|