老师给看一下,,红色那里错误,从字符串“名字”到类型integer的转换无效,这里不是这么写的吗
首先生成统计表
Dim dt As DataTable
Dim b As New SQLGroupTableBuilder("统计表1", "users")
b.C
b.Groups.AddDef("角色管理")
b.Groups.AddDef("name")
b.Totals.AddDef("_Identify", AggregateEnum.Count, "用户数") '根据主键列来统计记录数,也就是订单数
dt = b.Build(True) '参数设置为True,生成一个临时表,不在主界面显示
'然后根据统计表生成目录树
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt, "角色管理|name")
trv.StopRedraw
For Each nd As WinForm.TreeNode In trv.AllNodes
Dim nm As Integer = nd.DataRow("name")
Dim Product As String = nd.DataRow("角色管理")
Select Case nd.Level
Case 0
nd.Text = nd.text & "name(" & dt.Compute("Sum(用户数)", "name = " & nm) & "条)"
Case 1
nd.Text = nd.text & "(" & nd.DataRow("用户数") & ")"
End Select
Next
trv.Nodes.Insert("加载所有行", "加载所有行(" & dt.Compute("Sum(用户数)") & "条)", 0)
trv.ResumeRedraw