Foxtable(狐表)用户栏目专家坐堂 → [求助]成绩排名问题


  共有1952人关注过本帖树形打印复制链接

主题:[求助]成绩排名问题

帅哥哟,离线,有人找我吗?
有点色
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/5/16 17:51:00 [显示全部帖子]

Tables("成绩表").StopRedraw
Dim bjs As List(Of String()) = DataTables("成绩表").GetValues("学期|年级|班级","[班级] Is Not NULL")
Dim Count As Integer
Dim ColNames() As String = {"语文","数学","英语","化学","物理","总分"}
Dim TotalName As String
For Each ColName As String In ColNames
    For Each ary() As String In bjs
        Dim drs As List(Of DataRow) = DataTables("成绩表").Select("学期 = '" & ary(0) & "' and 年级 = '" & ary(1) & "' and 班级 = '" & ary(2) & "'", ColName & " DESC")
        Count = 0
        TotalName = ColName & "排名"
        For n As Integer = 0 To drs.Count - 1
            Count = Count + 1
            If n > 0 AndAlso drs(n)(ColName ) = drs(n-1)(ColName) Then
                drs(n)(TotalName ) = drs(n-1)(TotalName )
            Else
                drs(n)(TotalName ) = Count
            End If
        Next
    Next
Next
Tables("成绩表").Sort = "总分 DESC"
Tables("成绩表").ResumeRedraw

 回到顶部