在加载树显示统计数据的参考事例中,运行中遇到问题,生成的临时表是正确的如下:代码如下:
Dim dt As DataTable
Dim b As New SQLGroupTableBuilder("统计表1", "EI")
b.Groups.AddDef("人员类别")
b.Groups.AddDef("人员状态")
b.Groups.AddDef("性别")
b.Totals.AddDef("_Identify", AggregateEnum.Count, "人数") '根据主键列来统计记录数,也就是订单数
dt = b.Build()
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView2")
trv.BuildTree(dt, "人员类别|人员状态|性别")
trv.StopRedraw
For Each nd As WinForm.TreeNode In trv.AllNodes
Dim lb As String = nd.DataRow("人员类别")
Dim zt As String = nd.DataRow("人员状态")
Dim se As String = nd.DataRow("性别")
Select Case nd.Level
Case 0
nd.Text = nd.text & "人员类别(" & dt.Compute("Sum(人数)", "人员类别 = " & lb) & "人"
Case 1
nd.Text = nd.text & "人员状态(" & dt.Compute("Sum(人数)", "人员类别 = " & lb & " And 人员状态 = " & zt) & "人)"
Case 2
nd.Text = nd.text & "(" & nd.DataRow("人数") & ")"
End Select
Next
trv.Nodes.Insert("加载所有行", "加载所有行(" & dt.Compute("Sum(人数)") & "人)", 0)
trv.ResumeRedraw
出错提示:
看了半天也没看出来是哪里出错了,求指点