以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 程序运行效率求解释 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=116667) |
-- 作者:kgdce -- 发布时间:2018/3/29 9:33:00 -- 程序运行效率求解释 Dim uxuu As Integer = Tables("新设置起终值").FindRow("[行号] = \'" & cstr(shu1u) & "\'") Dim Intqszu As Single Dim Intzzzu As Single Dim ztintqszu As Single Dim ztintzzzu As Single If uxuu>=0 Then Intqszu = Tables("新设置起终值").Rows(uxuu)("区间起始值") Intzzzu = Tables("新设置起终值").Rows(uxuu)("区间终止值") ztintqszu=Tables("新设置起终值").Rows(uxuu)("总体起始值") ztintzzzu=Tables("新设置起终值").Rows(uxuu)("总体终止值") Dim drs1 As List(of DataRow) Dim sm As Integer = 0 drs1 = DataTables(scmb1).Select("[次次列] = \'" & aryu & "\'","[" & nam1 & "]") ‘为什么加上这一句就会运行速度提高数千倍,本身这一句从程序看是多余的。也就是说,选择行的时候先按部分条件(这个条件相当于不选表中的全部行),再根据条件选部分行,运行速度会大加快,请给解释。 Dim drs As List(of DataRow) drs = DataTables(scmb1).Select("[次次列]= \'" & aryu & "\'and [" & nam1 & "] >= " & ztIntqszu & "and [" & nam1 & "] < " & ztIntzzzu, "[" & nam1 & "]")\'注意要根据日期排序 Dim tm As Integer = drs.Count For Each dr2 As DataRow In drs
|
-- 作者:有点甜 -- 发布时间:2018/3/29 9:40:00 -- 没测试过你说的情况。如果要处理日期列,参考
http://www.foxtable.com/webhelp/scr/2219.htm
效率的文章看看
http://www.foxtable.com/webhelp/scr/2225.htm
具体问题,做个例子发上来测试 |