不用 EOF 以加快记录循环

      网站 2005-8-19 15:41
不用 EOF 以加快记录循环
作者: 时间: 2003-10-02 文档类型:原创 来自:蓝色理想
浏览统计 total:5824 | year:1152 | Quarter:195 | Month:85 | Week:18 | today:3




通常我们使用以下的代码进行记录循环:


Do while not records.eof
combo1.additem records![Full Name]
records.movenext
loop


结果是每个循环中数据库都要进行一次数据结束测试。在大量的记录的情况下, 浪费的时间相当大。 而使用以下的代码, 可以提高近 1/3 的速度:


records.movelast
intRecCount=records.RecordCount
records.movefirst

for intCounter=1 to intRecCount
combo1.additem records![Full Name]
records.movenext
next intCounter


出处:蓝色理想
责任编辑:蓝色

标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}