有错吧,代码没错怎么会报错?
这样试试。
Dim dt As DataTable = DataTables("八年级")
For i as Integer = Tables("八年级").cols.count - 11 to Tables("八年级").cols.count - 3
For Each dr as DataRow in dt.DataRows
dr("参考人数") = dt.Compute("count(单位)", "[单位] = '" & dr("单位") & "'")
dr("平均分") = dt.Compute("Avg(" & Tables("八年级").cols(i).name & ")", "[单位] = '" & dr("单位") & "'")
dr("最高分") = dt.Compute("Max(" & Tables("八年级").cols(i).name & ")", "[单位] = '" & dr("单位") & "'")
next
next
[此贴子已经被作者于2009-6-1 20:26:05编辑过]