-- 作者:hotday1972
-- 发布时间:2016/4/13 17:14:00
-- [求助]照着帮助写的代码报错
代码如下:
Dim dt As DataTable Dim b As New GroupTableBuilder("统计表1",DataTables("经验教训")) b.Groups.AddDef("编制日期",DateGroupEnum.Year,"年") b.Groups.AddDef("编制日期",DateGroupEnum.Month,"月") 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 Year As Integer = nd.DataRow("年") Dim Month As Integer = nd.DataRow("月") Dim Product As String = nd.DataRow("问题分类") Select Case nd.Level Case 0 nd.Text = nd.text & "年(" & dt.Compute("Sum(记录数)","年 = " & Year) & "条)" Case 1 nd.Text = nd.text & "月(" & dt.Compute("Sum(记录数)","年 = " & Year & " And 月 = " & Month) & "条)" Case 2 nd.Text = nd.text & "(" & nd.DataRow("记录数") & "条)" End Select Next trv.Nodes.Insert("记录总数","记录总数: (" & dt.Compute("Sum(记录数)") & "条)",0) trv.ResumeRedraw
错误如附件 此主题相关图片如下:错误.jpg
|