相关疑难解决方法(0)

为什么ADO Next记录处理在Delphi中变慢?

我有一个多年前开发的Delphi 4程序,它使用Opus DirectAccess顺序搜索Microsoft Access数据库并检索所需的记录.Delphi 4没有ADO,所以这就是我使用DirectAccess的原因.

但我现在升级到Delphi 2009并将程序转换为使用ADO.我发现通过表(大约100,000条记录)的循环开始时和DirectAccess一样快,但随后它开始变慢,并且当它通过表时变得越来越慢.基本循环是:

ArticlesTable.First;
while not Cancel and not ArticlesTable.Eof do begin

  ( See if the current record has criteria desired )
  ( If so, process the record )

  ArticlesTable.Next;
end;
Run Code Online (Sandbox Code Playgroud)

所以基本上,它只是使用.Next方法顺序处理记录.

那么为什么它会变慢,我怎么能重新编码它以免它变慢?

delphi performance ado

5
推荐指数
1
解决办法
4450
查看次数

标签 统计

ado ×1

delphi ×1

performance ×1