Dim n As Integer
Dim bjs As List(Of String)
bjs=DataTables("成绩表").GetUniqueValues("","班级")
For Each bj As String In bjs
Dim drs As New List(Of DataRow) = DataTables("成绩表").Select("[班级] = " & bj, "总分 DESC")
n = 0
For Each dr As DataRow In drs
If n > 0 AndAlso drs(n)("总分") = drs(n-1)("总分") Then
dr("总分排名") = drs(n-1)("总分排名") '则排名等于上一行
Else
dr("总分排名") = n + 1
End If
n+ = 1
Next