以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  数组内部函数的使用方法  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=25744)

--  作者:lpxjw_zyl
--  发布时间:2012/11/15 16:56:00
--  数组内部函数的使用方法
DataTables("成绩库").StopRedraw
Dim s1() As String = New String() {"总分"}
Dim dt As Table = Tables("成绩库")
StatusBar.Message1= "正在生成统计数据"
StatusBar.ProgressBar.Visible =True
StatusBar.ProgressBar.Minimum = 0
StatusBar.ProgressBar.Maximum =DataTables("成绩库").datarows.count
For i As Integer = 0 To DataTables("成绩库").Datarows.count - 1
    StatusBar.ProgressBar.Value = i + 1
    StatusBar.Message2= "已筛选记录" & i + 1 & "条"
    StatusBar.Refresh()
Next
Functions.Execute("排名",s1,Tables("成绩库"))
Functions.Execute("总分段",s1,"")
Functions.Execute("分段统计",s1,dt)
Functions.Execute("清零",s1,"")
DataTables("成绩库").ResumeRedraw

Dim Kms() As String = Args(0) ‘内部函数名分段统计
Dim dt As Table = Args(1)
Dim lms() As String = {"总分00分及以上","总分01分及以上","总分02分及以上","总分03分及以上","总分04分及以上","总分05分及以上","总分06分及以上","总分07分及以上","总分08分及以上","总分09分及以上"}
For Each Km As String In Kms
    For Each dr As DataRow In DataTables(Km & "1分段").DataRows
        For Each lm As String In lms
            dr(lm) = dt.DataTable.Compute("Count(姓名)", "[" & km & "] >= \'" & dr("分数段") + Val(lm.SubString(2,2)) & "\'")
        Next
    Next
Next

--  作者:lin_hailun
--  发布时间:2012/11/15 17:04:00
--  
 楼主,这个是分享,还是提问?