-- 作者:有点色
-- 发布时间:2017/5/18 17:07:00
--
DataColChanged事件代码
Dim dr As DataRow = e.DataRow Dim dt As DataTable =DataTables("学生成绩") Select Case e.DataCol.name Case "学期", "年级", "班级", "科目" If dr.IsNull("学期") = False AndAlso dr.IsNull("年级") = False AndAlso dr.IsNull("班级") = False AndAlso dr.IsNull("科目") = False Then Dim filter As String = "学期 = \'" & dr("学期") & "\' and 年级 = \'" & dr("年级") & "\' and 班级 = \'" & dr("班级") & "\'" dr("最高分") = dt.Compute("Max(" & dr("科目") & ")", filter) dr("最低分") = dt.Compute("Min(" & dr("科目") & ")", filter) dr("平均分") = dt.Compute("Avg(" & dr("科目") & ")", filter) dr("分布_60分以下") = dt.Compute("Count(姓名)", dr("科目") & " < 60 and " & filter) dr("分布_60分以上") = dt.Compute("Count(姓名)", dr("科目") & " >= 60 And " & dr("科目") & " < 70 and " & filter) dr("分布_70分以上") = dt.Compute("Count(姓名)", dr("科目") & " >= 70 And " & dr("科目") & " < 80 and " & filter) dr("分布_80分以上") = dt.Compute("Count(姓名)", dr("科目") & " >= 80 And " & dr("科目") & " < 90 and " & filter) dr("分布_90分以上") = dt.Compute("Count(姓名)", dr("科目") & " >= 90 And " & dr("科目") & " < 100 and " & filter) dr("分布_100分以上") = dt.Compute("Count(姓名)", dr("科目") & " >= 100 And " & dr("科目") & " < 110 and " & filter) dr("分布_110分以上") = dt.Compute("Count(姓名)", dr("科目") & " >= 110 And " & dr("科目") & " < 120 and " & filter) dr("分布_120分以上") = dt.Compute("Count(姓名)", dr("科目") & " >= 120 And " & dr("科目") & " < 130 and " & filter) dr("分布_130分以上") = dt.Compute("Count(姓名)", dr("科目") & " >= 130 and " & filter) End If End Select
[此贴子已经被作者于2017/5/18 17:15:30编辑过]
|