以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  代码太长了怎样检查正确与否?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=20125)

--  作者:lpxjw_zyl
--  发布时间:2012/5/29 22:53:00
--  代码太长了怎样检查正确与否?
 

StatusBar.Message1 = "正在全县排名,请稍后..."

Application.DoEvents()

Dim qxs As List(Of DataRow) = DataTables("招生数据").Select("[录取学校] is null ", "总分 DESC")

For i As Integer = 0 To qxs.Count - 1 \'遍历所有行

    qxs(i)("总分排名") = i + 1 \'设置排名

Next

Dim zf As Double = DataTables("招生数据").Compute("Sum(总分)", "[总分排名] = 1000 ") \'计算前1000名最低分数线

 

StatusBar.Message1 = "正在分类排名,请稍后..."

Application.DoEvents()

Dim xms As List(Of String) = DataTables("招生数据").GetUniqueValues("", "就读学校")

Dim szys() As String = {"重庆一中","重庆三中","重庆八中"}

For Each xm As String In xms

    For Each szy As String In szys

        Dim lqs As List(Of DataRow) = DataTables("招生数据").Select("[就读学校] = \'" & xm & "\' and [实验班志愿] = \'" & szy & "\' and [录取学校] is null","总分 DESC")

        For i As Integer = 0 To lqs.Count - 1 \'遍历所有行

            If  i > 0 AndAlso lqs(i)("总分") = lqs(i-1)("总分") Then \'如果总分和上一行相同

                lqs(i)("其它排名") = lqs(i-1)("其它排名") \'则排名等于上一行

            Else

                lqs(i)("其它排名") = i + 1 \'设置排名

            End If

        Next

    Next

Next

 

For Each xm As String In xms

    Dim jl As DataRow =  DataTables("实验指标分配").Find("[毕业学校] = \'" & xm & "\'")

    If jl IsNot Nothing Then

        For Each szy As String In szys

            Dim tj As String = "[就读学校] = \'" & xm & "\'and [实验班志愿] =\'" & szy & "\' and [录取学校] Is null and [总分] >= \'" & zf & "\' and [其它排名] > 0 and [其它排名] <= \'" & jl(szy & "_指标数") & "\'"

            Dim lqs As List(Of DataRow) = DataTables("招生数据").Select(tj,"总分 DESC")

            For i As Integer = 0 To lqs.count - 1

                StatusBar.Message1 = xm & ":第一批第一类," & szy & "已录取" & i+1 & "条记录."

                Application.DoEvents()

                lqs(i)("录取学校") = szy

                lqs(i)("录取说明") = "第一批第一类"

            Next

        Next

    End If

Next

 

For Each dr As DataRow In DataTables("实验指标分配").DataRows

    For Each szy As String In szys

        dr(szy & "_录取数") = DataTables("招生数据").Compute("count(姓名)", "[就读学校] = \'" & dr("毕业学校") & "\' and [录取学校] = \'" & szy & "\' and [录取说明] = \'第一批第一类\'")

        dr(szy & "_录取线") = DataTables("招生数据").Compute("Min(总分)", "[就读学校] = \'" & dr("毕业学校") & "\' and [录取学校] = \'" & szy & "\' and [录取说明] = \'第一批第一类\'")

        dr(szy & "_指标余额") = dr(szy & "_指标数") - dr(szy & "_录取数")

    Next

Next

 

For Each dr As DataRow In DataTables("录取统计").DataRows

    dr("第一批_第一类已录") = DataTables("招生数据").Compute("count(姓名)", "[录取学校] = \'" & dr("录取学校") & "\' and [录取说明] = \'第一批第一类\'")

    dr("第一批_差录") = dr("第一批_计划") - dr("第一批_第一类已录")

Next

 

StatusBar.Message1 = "正在初使化数据,请稍后..."

Application.DoEvents()

For Each dr As DataRow In DataTables("招生数据").DataRows \'录取第一批第二类

    dr("其它排名") = Nothing

Next

StatusBar.Message1 = "正在分类排名,请稍后..."

Application.DoEvents()

For Each szy As String In szys

    Dim lqs As List(Of DataRow) = DataTables("招生数据").Select("[实验班志愿] = \'" & szy & "\' and [录取学校] is null","总分 DESC")

    For i As Integer = 0 To lqs.Count - 1 \'遍历所有行

        If  i > 0 AndAlso lqs(i)("总分") = lqs(i-1)("总分") Then \'如果总分和上一行相同

            lqs(i)("其它排名") = lqs(i-1)("其它排名") \'则排名等于上一行

        Else

            lqs(i)("其它排名") = i + 1 \'设置排名

        End If

    Next

Next

 

For Each szy As String In szys

    Dim jl As DataRow = DataTables("录取统计").Find("[录取学校] = \'" & szy & "\'")

    If jl IsNot Nothing Then

        Dim tj As String = "[实验班志愿] =\'" & szy & "\' and [录取学校] Is null and [其它排名] > 0 and [其它排名] <= \'" & jl("第一批_差录") & "\'"

        Dim lqs As List(Of DataRow) = DataTables("招生数据").Select(tj,"总分 DESC")

        For i As Integer = 0 To lqs.count -1

            StatusBar.Message1 = szy & ":第一批第二类,已录取" & i+1 & "条记录."

            Application.DoEvents()

            lqs(i)("录取学校") = szy

            lqs(i)("录取说明") = "第一批第二类"

        Next

    End If

Next

 

For Each dr As DataRow In DataTables("实验拉通录取").DataRows

    For Each szy As String In szys

        dr(szy & "_录取数") = DataTables("招生数据").Compute("count(姓名)", "[就读学校] = \'" & dr("毕业学校") & "\' and [录取学校] = \'" & szy & "\' and [录取说明] = \'第一批第二类\'")

        dr(szy & "_录取线") = DataTables("招生数据").Compute("Min(总分)", "[录取学校] = \'" & szy & "\' and [录取说明] = \'第一批第二类\'")

    Next

Next

 

For Each dr As DataRow In DataTables("录取统计").DataRows

    dr("第一批_第二类已取") = DataTables("招生数据").Compute("count(姓名)", "[录取学校] = \'" & dr("录取学校") & "\' and [录取说明] = \'第一批第二类\'")

    dr("第一批_差录") = dr("第一批_计划") - dr("第一批_第一类已录") - dr("第一批_第二类已取")

Next

 

StatusBar.Message1 = "正在初使化数据,请稍后..."

Application.DoEvents()

For Each dr As DataRow In DataTables("招生数据").DataRows \'录取第二批第一类

    dr("其它排名") = Nothing

Next

StatusBar.Message1 = "正在分类排名,请稍后..."

Application.DoEvents()

Dim pzys() As String = {"重庆一中","重庆三中","重庆八中","巴蜀中学","育才中学","外语学校","西师附中"}

For Each pzy As String In pzys

    Dim lqs As List(Of DataRow) = DataTables("招生数据").Select("[普通班志愿] = \'" & pzy & "\' and [录取学校] is null","总分 DESC")

    For i As Integer = 0 To lqs.Count - 1 \'遍历所有行

        If  i > 0 AndAlso lqs(i)("总分") = lqs(i-1)("总分") Then \'如果总分和上一行相同

            lqs(i)("其它排名") = lqs(i-1)("其它排名") \'则排名等于上一行

        Else

            lqs(i)("其它排名") = i + 1 \'设置排名

        End If

    Next

Next

 

For Each pzy As String In pzys

    Dim jl As DataRow = DataTables("录取统计").Find("[录取学校] = \'" & pzy & "\'")

    If jl IsNot Nothing Then

        Dim tj As String = "[普通班志愿] =\'" & pzy & "\' and [录取学校] Is null and [其它排名] > 0 and [其它排名] <= \'" & jl("第二批_第一类计划") & "\'"

        Dim lqs As List(Of DataRow) = DataTables("招生数据").Select(tj,"总分 DESC")

        For i As Integer = 0 To lqs.count -1

            StatusBar.Message1 = pzy & ":第二批第一类,已录取" & i+1 & "条记录."

            Application.DoEvents()

            lqs(i)("录取学校") = pzy

            lqs(i)("录取说明") = "第二批第一类"

        Next

    End If

Next

 

For Each dr As DataRow In DataTables("普通拉通录取").DataRows

    For Each pzy As String In pzys

        dr(pzy & "_录取数") = DataTables("招生数据").Compute("count(姓名)", "[就读学校] = \'" & dr("毕业学校") & "\' and [录取学校] = \'" & pzy & "\' and [录取说明] = \'第二批第一类\'")

        dr(pzy & "_录取线") =  DataTables("招生数据").Compute("Min(总分)", "[录取学校] = \'" & pzy & "\' and [录取说明] = \'第二批第一类\'")

    Next

Next

 

For Each dr As DataRow In DataTables("录取统计").DataRows

    dr("第二批_第一类已录") = DataTables("招生数据").Compute("count(姓名)", "[录取学校] = \'" & dr("录取学校") & "\' and [录取说明] = \'第二批第一类\'")

    dr("第二批_差录") = dr("第二批_计划") - dr("第二批_第一类已录")

Next

 

StatusBar.Message1 = "正在初使化数据,请稍后..."

Application.DoEvents()

For Each dr As DataRow In DataTables("招生数据").DataRows \'录取第二批第二类

    dr("其它排名") = Nothing

Next

 

StatusBar.Message1 = "正在分类排名,请稍后..."

Application.DoEvents()

For Each xm As String In xms

    For Each pzy As String In pzys

        Dim lqs As List(Of DataRow) = DataTables("招生数据").Select("[就读学校] = \'" & xm & "\' and [普通班志愿] = \'" & pzy & "\' and [录取学校] is null","总分 DESC")

        For i As Integer = 0 To lqs.Count - 1 \'遍历所有行

            If  i > 0 AndAlso lqs(i)("总分") = lqs(i-1)("总分") Then \'如果总分和上一行相同

                lqs(i)("其它排名") = lqs(i-1)("其它排名") \'则排名等于上一行

            Else

                lqs(i)("其它排名") = i + 1 \'设置排名

            End If

        Next

    Next

Next

 

Dim zd As Double = DataTables("招生数据").Compute("Sum(总分)", "[总分排名] = 3800 ") \'计算前3800名最低分数线

Dim pt As Double = DataTables("招生数据").Compute("Sum(总分)", "[总分排名] = 6000 ") \'计算前6000名最低分数线

For Each xm As String In xms

    Dim jl As DataRow =  DataTables("普通指标分配").Find("[毕业学校] = \'" & xm & "\'")

    If jl IsNot Nothing Then

        For Each pzy As String In pzys

            If pzy = "梁平中学" OrElse pzy = "红旗中学" Then

                Dim tj As String = "[就读学校] = \'" & xm & "\'and [普通班志愿] =\'" & pzy & "\' and [录取学校] Is null and [总分] >= \'" & zd & "\' and [其它排名] > 0 and [其它排名] <= \'" & jl(pzy & "_指标数") & "\'"

                Dim lqs As List(Of DataRow) = DataTables("招生数据").Select(tj,"总分 DESC")

                For i As Integer = 0 To lqs.count - 1

                    StatusBar.Message1 = xm & ":第二批第二类," & pzy & "已录取" & i+1 & "条记录."

                    Application.DoEvents()

                    lqs(i)("录取学校") = pzy

                    lqs(i)("录取说明") = "第二批第二类"

                Next

            Else

                Dim tj As String = "[就读学校] = \'" & xm & "\'and [普通班志愿] =\'" & pzy & "\' and [录取学校] Is null and [总分] >= \'" & pt & "\' and [其它排名] > 0 and [其它排名] <= \'" & jl(pzy & "_指标数") & "\'"

                Dim lqs As List(Of DataRow) = DataTables("招生数据").Select(tj,"总分 DESC")

                For i As Integer = 0 To lqs.count - 1

                    StatusBar.Message1 = xm & ":第二批第二类," & pzy & "已录取" & i+1 & "条记录."

                    Application.DoEvents()

                    lqs(i)("录取学校") = pzy

                    lqs(i)("录取说明") = "第二批第二类"

                Next

            End If

        Next

    End If

Next

 

For Each dr As DataRow In DataTables("普通指标分配").DataRows

    For Each pzy As String In pzys

        dr(pzy & "_录取数") = DataTables("招生数据").Compute("count(姓名)", "[就读学校] = \'" & dr("毕业学校") & "\' and [录取学校] = \'" & pzy & "\' and [录取说明] = \'第二批第二类\'")

        dr(pzy & "_录取线") = DataTables("招生数据").Compute("Min(总分)", "[就读学校] = \'" & dr("毕业学校") & "\' and [录取学校] = \'" & pzy & "\' and [录取说明] = \'第二批第二类\'")

        dr(pzy & "_指标余额") = dr(pzy & "_指标数") - dr(pzy & "_录取数")

    Next

Next

 

For Each dr As DataRow In DataTables("录取统计").DataRows

    dr("第二批_第二类已录") = DataTables("招生数据").Compute("count(姓名)", "[录取学校] = \'" & dr("录取学校") & "\' and [录取说明] = \'第二批第二类\'")

    dr("第二批_差录") = dr("统招计划") - dr("提前批录取")- dr("第一批_第一类已录") - dr("第一批_第二类已取") - dr("第二批_第一类计划") - dr("第二批_第二类已录")

Next

 

StatusBar.Message1 = "正在初使化数据,请稍后..."

Application.DoEvents()

For Each dr As DataRow In DataTables("招生数据").DataRows \'录取第二批补充录取

    dr("其它排名") = Nothing

Next

 

Dim dx As Double = DataTables("招生数据").Compute("Sum(总分)", "[总分排名] = 10000 ") \'计算最低线10000名最低分数线

StatusBar.Message1 = "正在分类排名,请稍后..."

Application.DoEvents()

For Each pzy As String In pzys

    Dim lqs As List(Of DataRow) = DataTables("招生数据").Select("[普通班志愿] = \'" & pzy & "\' and [录取学校] is null","总分 DESC")

    For i As Integer = 0 To lqs.Count - 1 \'遍历所有行

        If  i > 0 AndAlso lqs(i)("总分") = lqs(i-1)("总分") Then \'如果总分和上一行相同

            lqs(i)("其它排名") = lqs(i-1)("其它排名") \'则排名等于上一行

        Else

            lqs(i)("其它排名") = i + 1 \'设置排名

        End If

    Next

Next

 

For Each pzy As String In pzys

    Dim jl As DataRow = DataTables("录取统计").Find("[录取学校] = \'" & pzy & "\'")

    If jl IsNot Nothing Then

        Dim tj As String = "[普通班志愿] =\'" & pzy & "\' and [录取学校] Is null and [总分] >= 0 and [其它排名] > 0 and [其它排名] <= \'" & jl("第二批_差录") & "\'"

        Dim lqs As List(Of DataRow) = DataTables("招生数据").Select(tj,"总分 DESC")

        For i As Integer = 0 To lqs.count -1

            StatusBar.Message1 = pzy & ":第二批补充录取,已录取" & i+1 & "条记录."

            Application.DoEvents()

            lqs(i)("录取学校") = pzy

            lqs(i)("录取说明") = "第二批补充录取"

        Next

    End If

Next

 

For Each dr As DataRow In DataTables("普通补充录取").DataRows

    For Each pzy As String In pzys

        dr(pzy & "_录取数") = DataTables("招生数据").Compute("count(姓名)", "[就读学校] = \'" & dr("毕业学校") & "\' and [录取学校] = \'" & pzy & "\' and [录取说明] = \'第二批补充录取\'")

        dr(pzy & "_录取线") = DataTables("招生数据").Compute("Min(总分)", "[录取学校] = \'" & pzy & "\' and [录取说明] = \'第二批补充录取\'")

    Next

Next

 

For Each dr As DataRow In DataTables("录取统计").DataRows

    dr("第二批_补充已录") = DataTables("招生数据").Compute("count(姓名)", "[录取学校] = \'" & dr("录取学校") & "\' and [录取说明] = \'第二批补充录取\'")

    dr("第二批_差录") =dr("统招计划") - dr("提前批录取")- dr("第一批_第一类已录") - dr("第一批_第二类已取") - dr("第二批_第一类计划") - dr("第二批_第二类已录") -dr("第二批_补充已录")

Next

 

StatusBar.Message1 = "正在初使化数据,请稍后..."

Application.DoEvents()

For Each dr As DataRow In DataTables("招生数据").DataRows \'第二批调剂录取

    dr("其它排名") = Nothing

Next

 

StatusBar.Message1 = "正在划分调剂学校,请稍后..."

Application.DoEvents()

For Each dr As DataRow In DataTables("招生数据").Select("[普通班调剂] = \'是\'")

    Dim dr1 As DataRow = DataTables("普通指标分配").Find("[毕业学校] = \'" & dr("就读学校") & "\'")

    If dr1 IsNot Nothing Then

        dr("调剂学校") = dr1("录取学校")

    End If

Next

 

For Each pzy As String In pzys

    Dim jl As DataRow = DataTables("录取统计").Find("[录取学校] = \'" & pzy & "\'")

    If jl IsNot Nothing AndAlso jl("第二批_差录") > 0 Then

        If pzy = "梁平中学" OrElse pzy = "红旗中学" OrElse pzy = "第一中学" Then

            Dim lqs As List(Of DataRow) = DataTables("招生数据").Select("[普通班调剂] = \'是\' and [录取学校] is null","总分 DESC")

            For i As Integer = 0 To lqs.Count - 1 \'遍历所有行

                If  i > 0 AndAlso lqs(i)("总分") = lqs(i-1)("总分") Then \'如果总分和上一行相同

                    lqs(i)("其它排名") = lqs(i-1)("其它排名") \'则排名等于上一行

                Else

                    lqs(i)("其它排名") = i + 1 \'设置排名

                End If

            Next

            Dim tj As String = "[普通班调剂] =\'是\' and [录取学校] Is null and [总分] >= 0 and [其它排名] > 0 and [其它排名] <= \'" & jl("第二批_差录") & "\'"

            Dim lq1s As List(Of DataRow) = DataTables("招生数据").Select(tj,"总分 DESC")

            For i As Integer = 0 To lq1s.count -1

                StatusBar.Message1 = pzy & ":第二批调剂录取,已录取" & i+1 & "条记录."

                Application.DoEvents()

                lq1s(i)("录取学校") = pzy

                lq1s(i)("录取说明") = "第二批调剂录取"

            Next

        Else

            Dim lqs As List(Of DataRow) = DataTables("招生数据").Select("[调剂学校] = \'" & pzy & "\' and [普通班调剂] = \'是\' and [录取学校] is null","总分 DESC")

            For i As Integer = 0 To lqs.Count - 1 \'遍历所有行

                If  i > 0 AndAlso lqs(i)("总分") = lqs(i-1)("总分") Then \'如果总分和上一行相同

                    lqs(i)("其它排名") = lqs(i-1)("其它排名") \'则排名等于上一行

                Else

                    lqs(i)("其它排名") = i + 1 \'设置排名

                End If

            Next

            Dim tj As String = "[调剂学校] = \'" & pzy & "\' and [普通班调剂] =\'是\' and [录取学校] Is null and [总分] >= 0 and [其它排名] > 0 and [其它排名] <= \'" & jl("第二批_差录") & "\'"

            Dim lq1s As List(Of DataRow) = DataTables("招生数据").Select(tj,"总分 DESC")

            For i As Integer = 0 To lq1s.count -1

                StatusBar.Message1 = pzy & ":第二批调剂录取,已录取" & i+1 & "条记录."

                Application.DoEvents()

                lq1s(i)("录取学校") = pzy

                lq1s(i)("录取说明") = "第二批调剂录取"

            Next

        End If

    End If

Next

 

For Each dr As DataRow In DataTables("普通调剂录取").DataRows

    For Each pzy As String In pzys

        dr(pzy & "_录取数") = DataTables("招生数据").Compute("count(姓名)", "[就读学校] = \'" & dr("毕业学校") & "\' and [录取学校] = \'" & pzy & "\' and [录取说明] = \'第二批调剂录取\'")

        dr(pzy & "_录取线") = DataTables("招生数据").Compute("Min(总分)", "[录取学校] = \'" & pzy & "\' and [录取说明] = \'第二批调剂录取\'")

    Next

Next

 

For Each dr As DataRow In DataTables("录取统计").DataRows

    dr("第二批_调剂已录") = DataTables("招生数据").Compute("count(姓名)", "[录取学校] = \'" & dr("录取学校") & "\' and [录取说明] = \'第二批调剂录取\'")

    dr("第二批_差录") = dr("统招计划") - dr("提前批录取")- dr("第一批_第一类已录") - dr("第一批_第二类已取") - dr("第二批_第一类计划") - dr("第二批_第二类已录") -dr("第二批_补充已录") - dr("第二批_调剂已录")

Next

 

StatusBar.Message1 = "正在初使化数据,请稍后..."

Application.DoEvents()

For Each dr As DataRow In DataTables("招生数据").DataRows \'录取第三批第一类

    dr("其它排名") = Nothing

Next

 

StatusBar.Message1 = "正在分类排名,请稍后..."

Application.DoEvents()

For Each pzy As String In pzys

    Dim lqs As List(Of DataRow) = DataTables("招生数据").Select("[择校生志愿] = \'" & pzy & "\' and [录取学校] is null","总分 DESC")

    For i As Integer = 0 To lqs.Count - 1 \'遍历所有行

        If  i > 0 AndAlso lqs(i)("总分") = lqs(i-1)("总分") Then \'如果总分和上一行相同

            lqs(i)("其它排名") = lqs(i-1)("其它排名") \'则排名等于上一行

        Else

            lqs(i)("其它排名") = i + 1 \'设置排名

        End If

    Next

Next

 

Dim zzd As Double = DataTables("招生数据").Compute("Sum(总分)", "[总分排名] = 7500 ") \'计算前7500名最低分数线

Dim zpt As Double = DataTables("招生数据").Compute("Sum(总分)", "[总分排名] = 8500 ") \'计算前8500名最低分数线

 

For Each pzy As String In pzys

    Dim jl As DataRow =  DataTables("录取统计").Find("[录取学校] = \'" & pzy & "\'")

    If jl IsNot Nothing Then

        If pzy = "梁平中学" OrElse pzy = "红旗中学" Then

            Dim tj As String = "[择校生志愿] =\'" & pzy & "\' and [录取学校] Is null and [总分] >= \'" & zzd & "\' and [其它排名] > 0 and [其它排名] <= \'" & jl("择校计划") & "\'"

            Dim lqs As List(Of DataRow) = DataTables("招生数据").Select(tj,"总分 DESC")

            For i As Integer = 0 To lqs.count - 1

                StatusBar.Message1 = pzy & ":第三批第一类,已录取" & i+1 & "条记录."

                Application.DoEvents()

                lqs(i)("录取学校") = pzy

                lqs(i)("录取说明") = "第三批第一类"

            Next

        Else

            Dim tj As String = "[择校生志愿] =\'" & pzy & "\' and [录取学校] Is null and [总分] >= \'" & zpt & "\' and [其它排名] > 0 and [其它排名] <= \'" & jl("择校计划") & "\'"

            Dim lqs As List(Of DataRow) = DataTables("招生数据").Select(tj,"总分 DESC")

            For i As Integer = 0 To lqs.count - 1

                StatusBar.Message1 = pzy & ":第三批第一类,已录取" & i+1 & "条记录."

                Application.DoEvents()

                lqs(i)("录取学校") = pzy

                lqs(i)("录取说明") = "第三批第一类"

            Next

        End If

    End If

Next

 

For Each dr As DataRow In DataTables("择校拉通录取").DataRows

    For Each pzy As String In pzys

        dr(pzy & "_录取数") = DataTables("招生数据").Compute("count(姓名)", "[就读学校] = \'" & dr("毕业学校") & "\' and [录取学校] = \'" & pzy & "\' and [录取说明] = \'第三批第一类\'")

        dr(pzy & "_录取线") = DataTables("招生数据").Compute("Min(总分)", "[录取学校] = \'" & pzy & "\' and [录取说明] = \'第三批第一类\'")

    Next

Next

 

For Each dr As DataRow In DataTables("录取统计").DataRows

    dr("第三批_第一类已录") = DataTables("招生数据").Compute("count(姓名)", "[录取学校] = \'" & dr("录取学校") & "\' and [录取说明] = \'第三批第一类\'")

    dr("第三批_差录") = dr("择校计划") - dr("第三批_第一类已录")

Next

 

StatusBar.Message1 = "正在初使化数据,请稍后..."

Application.DoEvents()

For Each dr As DataRow In DataTables("招生数据").DataRows \'第三批调剂录取

    dr("其它排名") = Nothing

Next

 

For Each pzy As String In pzys

    Dim jl As DataRow = DataTables("录取统计").Find("[录取学校] = \'" & pzy & "\'")

    If jl IsNot Nothing AndAlso jl("第三批_差录") > 0 Then

        If pzy = "梁平中学" OrElse pzy = "红旗中学" OrElse pzy = "第一中学" Then

            Dim lqs As List(Of DataRow) = DataTables("招生数据").Select("[普通班调剂] = \'是\' and [录取学校] is null","总分 DESC")

            For i As Integer = 0 To lqs.Count - 1 \'遍历所有行

                If  i > 0 AndAlso lqs(i)("总分") = lqs(i-1)("总分") Then \'如果总分和上一行相同

                    lqs(i)("其它排名") = lqs(i-1)("其它排名") \'则排名等于上一行

                Else

                    lqs(i)("其它排名") = i + 1 \'设置排名

                End If

            Next

            Dim tj As String = "[普通班调剂] =\'是\' and [录取学校] Is null and [总分] >= 0 and [其它排名] > 0 and [其它排名] <= \'" & jl("第三批_差录") & "\'"

            Dim lq1s As List(Of DataRow) = DataTables("招生数据").Select(tj,"总分 DESC")

            For i As Integer = 0 To lq1s.count -1

                StatusBar.Message1 = pzy & ":第三批调剂录取,已录取" & i+1 & "条记录."

                Application.DoEvents()

                lq1s(i)("录取学校") = pzy

                lq1s(i)("录取说明") = "第三批调剂录取"

            Next

        Else

            Dim lqs As List(Of DataRow) = DataTables("招生数据").Select("[调剂学校] = \'" & pzy & "\' and [普通班调剂] = \'是\' and [录取学校] is null","总分 DESC")

            For i As Integer = 0 To lqs.Count - 1 \'遍历所有行

                If  i > 0 AndAlso lqs(i)("总分") = lqs(i-1)("总分") Then \'如果总分和上一行相同

                    lqs(i)("其它排名") = lqs(i-1)("其它排名") \'则排名等于上一行

                Else

                    lqs(i)("其它排名") = i + 1 \'设置排名

                End If

            Next

            Dim tj As String = "[调剂学校] = \'" & pzy & "\' and [普通班调剂] =\'是\' and [录取学校] Is null and [总分] >= 0 and [其它排名] > 0 and [其它排名] <= \'" & jl("第三批_差录") & "\'"

            Dim lq1s As List(Of DataRow) = DataTables("招生数据").Select(tj,"总分 DESC")

            For i As Integer = 0 To lq1s.count -1

                StatusBar.Message1 = pzy & ":第三批调剂录取,已录取" & i+1 & "条记录."

                Application.DoEvents()

                lq1s(i)("录取学校") = pzy

                lq1s(i)("录取说明") = "第三批调剂录取"

            Next

        End If

    End If

Next

 

For Each dr As DataRow In DataTables("择校调剂录取").DataRows

    For Each pzy As String In pzys

        dr(pzy & "_录取数") = DataTables("招生数据").Compute("count(姓名)", "[就读学校] = \'" & dr("毕业学校") & "\' and [录取学校] = \'" & pzy & "\' and [录取说明] = \'第三批调剂录取\'")

        dr(pzy & "_录取线") = DataTables("招生数据").Compute("Min(总分)", "[录取学校] = \'" & pzy & "\' and [录取说明] = \'第三批调剂录取\'")

    Next

Next

 

For Each dr As DataRow In DataTables("录取统计").DataRows

    dr("第三批_调剂已录") = DataTables("招生数据").Compute("count(姓名)", "[录取学校] = \'" & dr("录取学校") & "\' and [录取说明] = \'第三批调剂录取\'")

    dr("第三批_差录") = dr("择校计划") - dr("第三批_第一类已录") -dr("第三批_调剂已录")

Next


--  作者:狐狸爸爸
--  发布时间:2012/5/29 23:19:00
--  

建议看看:
 
http://www.foxtable.com/help/topics/1485.htm

 


--  作者:blackzhu
--  发布时间:2012/5/30 7:28:00
--  
这个代码是够长的.
--  作者:lihe60
--  发布时间:2012/5/30 7:32:00
--  

巨无霸。