我有一个多年前开发的Delphi 4程序,它使用Opus DirectAccess来顺序搜索Microsoft Access数据库并检索所需的记录。 Delphi 4没有ADO,所以这就是我使用DirectAccess的原因。为什么在Delphi中ADO Next记录处理速度变慢?
但我现在升级到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;
所以基本上,它只是使用.Next方法按顺序处理记录。
那么为什么它放缓,我怎么能重新编码这个,以便它不会放慢速度?
添加“ArticlesTable.DisableControls;”在“ArticlesTable.First;”之前解决了这个问题。完善!非常感谢! – lkessler 2009-09-30 06:30:08