当前位置:首页 > 网络编程 > 数据库 > ACCESS > 如何优化Access数据库

如何优化Access数据库

点击次数:23 次 发布日期:2008-11-22 13:50:50 作者:源代码网
源代码网推荐

How to speed up database access

Here is a trick to loop through a recordset faster. Often when looping through a recordset people will use the following code:

Do While Not Records.EOF
  Combo1.AddItem Records![Full Name]
  Eecords.Movenext
LoopThe problem is that everytime the database moves to the next record it must make a check to see if it has reached the end of the file. This slows the looping down a great deal. When moving or searching throuch a large record set this can make a major difference. Here is a better way to do it.

Records.MoveLast
intRecCount=Records.RecordCount
Records.MoveFirst

For intCounter=1 To intRecCount
  Combo1.AddItem Records![Full Name]
  Records.MoveNext
Next intCounterYou should see about a 33% speed increase.

源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华