以下是引用game178在2019/6/20 16:17:00的发言:
如果清空成绩排名数据后,再点,没反应。
删除红色代码,即可
Dim f As New Filler
f.SourceTable = DataTables("成绩加载表")
f.SourceCols = "考试性质,考试年月,学校,班级,姓名,科类,考号,语文,数学,英语,物理,化学,生物,政治,历史,地理"
f.DataTable = DataTables("成绩排名")
f.DataCols = "考试性质,考试年月,学校,班级,姓名,科类,考号,语文,数学,英语,物理,化学,生物,政治,历史,地理"
f.ExcludeExistValue = True
f.ExcludeNullValue = True
f.Fill
Dim pm As List(Of String()) = DataTables("成绩排名").getvalues("考试年月|班级","")
'获取考试年月和班级为名单
Dim pmc As Integer
Dim ColNames() As String = {"语文","数学","英语","物理","化学","生物","政治","历史","地理","总分"}
Dim TotalName As String
For Each ColName As String In ColNames
For i As Integer = 0 To pm.Count -1
If pm(i)(0) = "" Then
Continue For
End If
Dim drs As List(Of DataRow) = DataTables("成绩排名").Select("[考试年月] = '" & pm(i)(0) & "'And [班级] = '" & pm(i)(1) & "'", ColName & " DESC")
pmc = 0
TotalName = ColName & "排名"
For n As Integer = 0 To drs.Count - 1
pmc = pmc +1
If n > 0 AndAlso drs(n)(ColName ) = drs(n-1)(ColName) Then
drs(n)(TotalName ) = drs(n-1)(TotalName )
Else
drs(n)(TotalName ) = pmc
End If
Next
Next
Next
Tables("成绩排名").Sort = "考试年月,班级,总分排名"
'Time1 = Date.Now
'e.Form.Controls("Label1").text="耗时 " & (Time1-Time).TotalSeconds & " 秒"