\'首先生成统计表
此主题相关图片如下:无标题.png
Dim dt As DataTable
Dim b As New SQLGroupTableBuilder("qryryxxtjtj","tbl_zl_ryxx")
b.AddTable("tbl_zl_ryxx","gzcj","tbl_jczl_gsbm","dm")
b.Groups.AddDef("name", "bm")
b.Groups.AddExp("zt"," Case WHEN lzrq Is NULL Then \'在职\' ELSE \'离职\' END")
b.Totals.AddDef("gzcj",AggregateEnum.Count,"rs") \'根据主键列来统计记录数,也就是人数
dt = b.Build(True) \'参数设置为True,生成一个临时表,不在主界面显示
\'然后根据统计表生成目录树
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt, "zt|bm")