看了“手工编码进行统计”帮助这一节:
此主题相关图片如下:剪辑_2666.jpg

我也有一个人员信息统计需求,与帮助类似,但是统计条件较多多,

此主题相关图片如下:20142282247992993.jpg

Dim dr As DataRow = e.DataRow
Dim dt As Table =Tables("表A")
If e.DataCol.Name = "单位" And dr.IsNull("单位") = False Then
dr("人数_总数") = dt. Compute("Count(姓名)","[单位] = '" & dr("单位") & "'")
dr("按性别_男") = dt. Compute("Count(姓名)","[单位] = '" & dr("单位") & "' And [性别] ='男'")
dr("按性别_女") = dt. Compute("Count(姓名)","[单位] = '" & dr("单位") & "' And [性别] ='女'")
dr("按年龄_18至20")= dt. Compute("Count(姓名)","[单位] = '" & dr("单位") & "' And [年龄] >= 18 And 年龄 <=20")
dr("按年龄_21至25")= dt. Compute("Count(姓名)","[单位] = '" & dr("单位") & "' And [年龄] >= 21 And 年龄 <=25")
后续代码省略.........
进入表时,会自动重置统计表的单位列,以刷新数据,但统计较慢。
想请教狐爸,此类统计有无其他途径实现以尽可能提高点效率?
[此贴子已经被作者于2014-3-18 11:54:58编辑过]