总分列用的是表达式,统计代码是写在 分数段统计_DataColChanged
Dim dr As DataRow = e.DataRow
Dim dt As DataTable =DataTables("学生成绩库")
If e.DataCol.Name = "科目" And e.DataRow.IsNull("科目") = False Then
e.DataRow("参考人数") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 0 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("最高分") = Math.Round(dt.Compute("max(" & dr("科目") & ")","[期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" ),1)
e.DataRow("最低分") = Math.Round(dt.Compute("min(" & dr("科目") & ")","[期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" ),1)
e.DataRow("平均分") = Math.Round(dt.Compute("Avg(" & dr("科目") & ")","[期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" ),1)
e.DataRow("T") = dt.Compute("Count(学生姓名)", dr("科目") & " Is Null And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("S") = dt.Compute("Count(学生姓名)", dr("科目") & " = 0 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("R") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 1 And " & dr("科目") & " < 10 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("Q") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 10 And " & dr("科目") & " < 20 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("P") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 20 And " & dr("科目") & " < 30 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("O") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 30 And " & dr("科目") & " < 36 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("N") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 36 And " & dr("科目") & " < 40 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("M") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 40 And " & dr("科目") & " < 48 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("L") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 48 And " & dr("科目") & " < 50 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("K") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 50 And " & dr("科目") & " < 60 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("J") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 60 And " & dr("科目") & " < 70 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("I") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 70 And " & dr("科目") & " < 72 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("H") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 72 And " & dr("科目") & " < 80 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("G") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 80 And " & dr("科目") & " < 90 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("F") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 90 And " & dr("科目") & " < 100 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("E") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 100 And " & dr("科目") & " < 110 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("D") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 110 And " & dr("科目") & " < 120 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("C") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 120 And " & dr("科目") & " < 130 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("B") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 130 And " & dr("科目") & " < 140 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
e.DataRow("A") = dt.Compute("Count(学生姓名)", dr("科目") & " >= 140 And [期数] = '" & e.DataRow("期数") & "'And [班级] = '" & e.DataRow("班级") & "'" )
End If