在ASP中不用EOF以加快循环

Posted on May 03, 2005 by Fdream

一般的记录循环方式:

Do while not rs.eof
……
rs.movenext
loop

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

rs.movelast
intRecCount=rs.RecordCount
rs.movefirst

for intCounter=1 to intRecCount
………
rs.movenext
next intCounter

分享 |
Categories:
Ajax Web
Tags:
,
Comments:
Leave a comment
Views:
14,389 Views

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>