Dim g As New sqlGroupTableBuilder("统计表1", "成绩")
g.C
Dim dt1 As Table = Tables("后台统计_table2")
g.Groups.AddDef("考试名称")
g.Groups.AddDef("单位名称")
g.Groups.AddDef("年级代码")
g.Groups.AddDef("班级")
g.Totals.AddDef("姓名",AggregateEnum.Count,"参考人数")
g.Totals.AddDef("语文_A",AggregateEnum.Average,"语文平均_A")
g.Totals.AddDef("语文_B",AggregateEnum.Average,"语文平均_B")
g.Totals.AddDef("数学_A",AggregateEnum.Average,"数学平均_A")
g.Totals.AddDef("数学_B",AggregateEnum.Average,"数学平均_B")
g.Totals.AddDef("英语_A",AggregateEnum.Average,"英语平均_A")
g.Totals.AddDef("英语_B",AggregateEnum.Average,"英语平均_B")
g.Totals.AddDef("政治_A",AggregateEnum.Average,"政治平均_A")
g.Totals.AddDef("政治_B",AggregateEnum.Average,"政治平均_B")
g.Totals.AddDef("历史_A",AggregateEnum.Average,"历史平均_A")
g.Totals.AddDef("历史_B",AggregateEnum.Average,"历史平均_B")
g.Totals.AddDef("物理_A",AggregateEnum.Average,"物理平均_A")
g.Totals.AddDef("物理_B",AggregateEnum.Average,"物理平均_B")
g.Totals.AddDef("化学_A",AggregateEnum.Average,"化学平均_A")
g.Totals.AddDef("化学_B",AggregateEnum.Average,"化学平均_B")
g.Totals.AddDef("生物_A",AggregateEnum.Average,"生物平均_A")
g.Totals.AddDef("生物_B",AggregateEnum.Average,"生物平均_B")
g.Totals.AddDef("地理_A",AggregateEnum.Average,"地理平均_A")
g.Totals.AddDef("地理_B",AggregateEnum.Average,"地理平均_B")
g.Totals.AddDef("体育",AggregateEnum.Average,"体育平均")
g.Totals.AddDef("物理实验",AggregateEnum.Average,"物理实验")
g.Totals.AddDef("化学实验",AggregateEnum.Average,"化学实验")
g.Totals.AddDef("总分",AggregateEnum.Average,"总分平均")
g.Totals.AddDef("折总",AggregateEnum.Average,"折总平均")
g.Totals.AddDef("总分",AggregateEnum.Average,"总分平均")
dt1.DataSource = g.BuildDataSource()
g.Totals.AddDef("折总",AggregateEnum.Average,"折总平均")
g.Totals.AddDef("总分",AggregateEnum.Average,"总分平均")
g.FromServer = True
dt1.DataSource = g.BuildDataSource()
dt1.DataTable.DataCols.Add("班级排名",Gettype(Integer))
dt1.DataTable.DataCols.Add("300分以下",Gettype(Integer))
For Each dr As DataRow In dt1.DataTable.DataRows
dr("300分以下") = DataTables("成绩").Compute("count(总分)","[考试名称] = '" & dr("考试名称") & "'and [年级代码] ='" & dr("年级代码") & "' and 单位名称 = '" & dr("单位名称") & "' and 班级='" & dr("班级") & "' and 总分 < 300" )
Next
''********"'And [班级] = '" & ary1(2) & And [单位名称] = '" & ary1(1) & "'
Dim Arys1 As List(Of String()) = dt1.DataTable.GetValues("考试名称|单位名称|年级代码")
For Each Ary1 As String() In Arys1
Dim drs As List(Of DataRow) = dt1.DataTable.Select("[考试名称] = '" & ary1(0) & "'and [年级代码] ='" & ary1(2) & "'", "折总平均 DESC")
For m As Integer = 0 To drs.Count - 1 '遍历所有行
If m > 0 AndAlso drs(m)("折总平均") = drs(m-1)("折总平均") Then '如果总分和上一行相同
drs(m)("班级排名") = drs(m-1)("班级排名") '则排名等于上一行
Else
drs(m)("班级排名") = m + 1 '设置排名
End If
Next
Next
''********
dt1.SetColVisibleWidth("考试名称|80|单位名称|160|年级代码|40|班级|30|参考人数|30|语文平均_A|40|语文平均_B|40|数学平均_A|30|数学平均_B|40|英语平均_A|40|英语平均_B|40|政治平均_A|40|政治平均_B|40|历史平均_A|40|历史平均_B|40|物理平均_A|40|物理平均_B|40|化学平均_A|40|化学平均_B|40|生物平均_A|40|生物平均_B|40|地理平均_A|40|地理平均_B|40|体育平均|40|物理实验|40|化学实验|40|总分平均|70|折总平均|70|班级排名|40|300分以下|20")
Dim btn2 As WinForm.Button = e.Form.Controls("Button2")
btn2.PerformClick()
老师,我改成上面的结果是说总分,折总列无效,请指导