Dim dr As DataRow = e.DataRow
Dim ds As DataRow
Dim dt As DataTable = DataTables("小生表")
Dim flt As String = "[考试名称] = '" & dr("考试名称") & "'and [学校班级] = '" & dr("学校班级") & "'"
If e.DataCol.Name = "学校班级" Then
dr("参考数") = dt.Compute("count(姓名)",flt)
dr("总分_人平") = format(dt.Compute("AVG(总分)",flt),"#.00")
If val(dr("年级")) <= 6
dr("语文_优秀率") = format(dt.Compute("count(姓名)","[语文] >= 85 and " & flt)*100/dr("参考数"),"#.00")
dr("语文_及格率") = format(dt.Compute("count(姓名)","[语文] >= 60 and " & flt)*100/dr("参考数"),"#.00")
dr("语文_人平") = format(dt.Compute("AVG(语文)",flt),"#.00")
dr("数学_优秀率") = format(dt.Compute("count(姓名)","[数学] >= 85 and " & flt)*100/dr("参考数"),"#.00")
dr("数学_及格率") = format(dt.Compute("count(姓名)","[数学] >= 60 and " & flt)*100/dr("参考数"),"#.00")
dr("数学_人平") = format(dt.Compute("AVG(数学)",flt),"#.00")
Else
dr("语文_优秀率") = format(dt.Compute("count(姓名)","[语文] >= 80 and " & flt)*100/dr("参考数"),"#.00")
dr("语文_及格率") = format(dt.Compute("count(姓名)","[语文] >= 60 and " & flt)*100/dr("参考数"),"#.00")
dr("语文_人平") = format(dt.Compute("AVG(语文)",flt),"#.00")
dr("数学_优秀率") = format(dt.Compute("count(姓名)","[数学] >= 80 and " & flt)*100/dr("参考数"),"#.00")
dr("数学_及格率") = format(dt.Compute("count(姓名)","[数学] >= 60 and " & flt)*100/dr("参考数"),"#.00")
dr("数学_人平") = format(dt.Compute("AVG(数学)",flt),"#.00")
dr("英语_优秀率") = format(dt.Compute("count(姓名)","[英语] >= 80 and " & flt)*100/dr("参考数"),"#.00")
dr("英语_及格率") = format(dt.Compute("count(姓名)","[英语] >= 60 and " & flt)*100/dr("参考数"),"#.00")
dr("英语_人平") = format(dt.Compute("AVG(数学)",flt),"#.00")
dr("政治_优秀率") = format(dt.Compute("count(姓名)","[政治] >= 80 and " & flt)*100/dr("参考数"),"#.00")
dr("政治_及格率") = format(dt.Compute("count(姓名)","[政治] >= 60 and " & flt)*100/dr("参考数"),"#.00")
dr("政治_人平") = format(dt.Compute("AVG(政治)",flt),"#.00")
dr("历史_优秀率") = format(dt.Compute("count(姓名)","[历史] >= 80 and " & flt)*100/dr("参考数"),"#.00")
dr("历史_及格率") = format(dt.Compute("count(姓名)","[历史] >= 60 and " & flt)*100/dr("参考数"),"#.00")
dr("历史_人平") = format(dt.Compute("AVG(历史)",flt),"#.00")
If val(dr("年级")) > 7
dr("物理_优秀率") = format(dt.Compute("count(姓名)","[物理] >= 80 and " & flt)*100/dr("参考数"),"#.00")
dr("物理_及格率") = format(dt.Compute("count(姓名)","[物理] >= 60 and " & flt)*100/dr("参考数"),"#.00")
dr("物理_人平") = format(dt.Compute("AVG(物理)",flt),"#.00")
End If
If val(dr("年级")) > 8
dr("化学_优秀率") = format(dt.Compute("count(姓名)","[化学] >= 80 and " & flt)*100/dr("参考数"),"#.00")
dr("化学_及格率") = format(dt.Compute("count(姓名)","[化学] >= 60 and " & flt)*100/dr("参考数"),"#.00")
dr("化学_人平") = format(dt.Compute("AVG(化学)",flt),"#.00")
End If
If val(dr("年级")) = 7 Or val(dr("年级")) = 8
dr("生物_优秀率") = format(dt.Compute("count(姓名)","[生物] >= 80 and " & flt)*100/dr("参考数"),"#.00")
dr("生物_及格率") = format(dt.Compute("count(姓名)","[生物] >= 60 and " & flt)*100/dr("参考数"),"#.00")
dr("生物_人平") = format(dt.Compute("AVG(生物)",flt),"#.00")
dr("地理_优秀率") = format(dt.Compute("count(姓名)","[地理] >= 80 and " & flt)*100/dr("参考数"),"#.00")
dr("地理_及格率") = format(dt.Compute("count(姓名)","[地理] >= 60 and " & flt)*100/dr("参考数"),"#.00")
dr("地理_人平") = format(dt.Compute("AVG(地理)",flt),"#.00")
End If
End If
ds = DataTables("师表").Find("考试名称 = '" & e.DataRow("考试名称") & "'and 学校班级 = '" & e.DataRow("学校班级") & "'" )
If ds IsNot Nothing
e.DataRow("语文_教师")= ds("语文教师")
e.DataRow("数学_教师")= ds("数学教师")
e.DataRow("英语_教师")= ds("英语教师")
e.DataRow("政治_教师")= ds("政治教师")
e.DataRow("历史_教师")= ds("历史教师")
e.DataRow("物理_教师")= ds("物理教师")
e.DataRow("化学_教师")= ds("化学教师")
e.DataRow("生物_教师")= ds("生物教师")
e.DataRow("地理_教师")= ds("地理教师")
End If
End If
.NET Framework 版本:2.0.50727.5485
Foxtable 版本:2016.7.29.1
错误所在事件:表,小班表, DataColChanged
详细错误信息:
调用的目标发生了异常。
从字符串“”到类型“Double”的转换无效。
输入字符串的格式不正确。
请问老师上面代码是错在哪里?