以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 同一段代码在不同的项目中为什么运行时间会相差很大? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=141734) |
-- 作者:erdbeer -- 发布时间:2019/10/10 1:33:00 -- 同一段代码在不同的项目中为什么运行时间会相差很大? Dim Filter As
String Dim Filter2 As
String Dim dr As DataRow = e.Node.DataRow \'获取生成此节点的行 If e.Node.Text <> "点击加载数据......"
Then Dim Year As Integer = e.Node.DataRow("年") Dim Month As Integer = e.Node.DataRow("月") Dim qy As String = e.Node.DataRow("区域") Dim khdm As String = e.Node.DataRow("客户代码") Select Case e.Node.Level Case 0 \'点击年份 Case 1 \'点击月份 Case 2 \'点击区域 Filter
= "区域 = \'" &
qy & "\'" DataTables("定单明细").loadFilter
= Filter DataTables("定单明细").Load() Tables("定单明细").Sort = "日期" DataTables("定单").loadFilter = Filter DataTables("定单").Load() Case 3 \'点击客户代码 Filter
="区域 = \'" & qy & "\' and 客户代码 = \'" &
khdm & "\'" Filter2
="区域 = \'" & qy & "\'" DataTables("定单明细").loadFilter
= Filter DataTables("定单明细").Load() Tables("定单明细").Sort
= "日期" DataTables("定单").loadFilter
= Filter2 DataTables("定单").Load() End Select End If 数据库是用的SQL,以上这段代码,在目前的项目中,加载运行的时间,大致都是在0.7~0.9秒之间,感觉很慢,我新建一个项目,里面就只有这个代码,运行的时间大致在0.04~0.08之间,相差了一个数量级,感觉就快多了,是什么影响了这个运行时间呢? |
-- 作者:狐狸爸爸 -- 发布时间:2019/10/10 8:26:00 -- 如果数据量一样,测试环境相同,可能是表达式造成的 |
-- 作者:erdbeer -- 发布时间:2019/10/10 8:50:00 -- 所有的环境都是一样的 狐爸 您说的表达式是指定单明细和定单表里面的表达式吗? 这个问题有解吗?
|
-- 作者:有点蓝 -- 发布时间:2019/10/10 10:01:00 -- 看看:http://www.foxtable.com/webhelp/topics/1935.htm |