使用ADO具有预读功能的DBGrid [英] DBGrid with read ahead capability using ADO
问题描述
我正在使用ADO连接到SQL Server 2005。
I'm working with ADO connecting to SQL Server 2005.
我的TADODataSet选择了100万条记录。使用TDBGrid并将 TADODataSet.CursorLocation
设置为 clUseServer
即可。但是TDBGrid令人窒息!
My TADODataSet selects 1 million records. using a TDBGrid and setting the TADODataSet.CursorLocation
to clUseServer
works. but the TDBGrid chokes!
我该如何选择100万条记录,避免分页,并且仍然能够在网格中显示记录,而无需将所有记录提取到客户端,
How can I select 1 million records, avoid paging, and still be able to display records in the grid without fetching ALL records to the client side, letting the Grid read ahead as I scroll up and down?
SQL企业管理器可以执行查询并异步选择100万条记录而没有任何问题(也是MS-ACCESS)。
SQL enterprise manager can execute a query and select 1 million records asynchronously without any problems (also MS-ACCESS).
推荐答案
TGrid不是您的问题。您的问题是TADODataset试图加载所有记录。如果必须运行返回这么多记录的查询,则应设置ExecuteOptions,尝试eoAsyncExecute和eoAsyncFetch。设置CacheSize也可能有帮助。
TGrid is not your problem. Your problem is TADODataset is trying to load all the records. If you must run a query that returns so many records, you should set ExecuteOptions, try eoAsyncExecute and eoAsyncFetch. It may also help to set CacheSize.
这篇关于使用ADO具有预读功能的DBGrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!