Dim st As Date = Date.Now
Dim lts As List(Of String)
Dim lts1 As List(Of String)
lts = DataTables("采集表").GetUniqueValues("", "民族")
lts1 = DataTables("采集表").GetUniqueValues("", "性别")
Dim b As New SQLGroupTableBuilder("综合统计","采集表")
b.Groups.Adddef("类别")
b.filter="类别 is not null"
b.Totals.Adddef("类别",AggregateEnum.Count,"小计")
For i As Integer = 0 To lts.count -1
b.Totals.Addexp("民族_"& lts(i),"IIF(民族 = 'lts(i)',1,0)")
Next
For i As Integer = 0 To lts1.count -1
b.Totals.Addexp("性别_"& lts1(i),"IIF(性别 = 'lts1(i)',1,0)")
Next
b.VerticalTotal = True
b.Build
With Tables("综合统计")
.DefaultColWidth = 40
.DefaultRowHeight = 40
.Cols(0).Width = 120
.AllowDragColumn = False
.AllowResizeRow = False
.SetHeaderRowHeight(40,100)
.AllowResizeColumn = False
.AllowEdit = False
.Grid.Styles.Normal.Border.Color = Color.black
End With
DataTables("综合统计").SysStyles("Alternate").BackColor = Color.LightYellow
MainTable = Tables("综合统计")
StatusBar.Message3 = "耗时: " & (Date.Now - st).TotalSeconds & "秒"