使用 ADO 具有预读功能的 DBGrid
我正在使用 ADO 连接到 SQL Server 2005。
我的 TADODataSet 选择 100 万条记录。使用 TDBGrid 并将 TADODataSet.CursorLocation
设置为 clUseServer
可以。但 TDBGrid 窒息了!
如何选择 100 万条记录,避免分页,并且仍然能够在网格中显示记录,而不将所有记录提取到客户端,让网格在我上下滚动时提前读取?
SQL企业管理器可以异步执行查询并选择100万条记录,没有任何问题(也是MS-ACCESS)。
I'm working with ADO connecting to SQL Server 2005.
My TADODataSet selects 1 million records. using a TDBGrid and setting the TADODataSet.CursorLocation
to clUseServer
works. but the TDBGrid chokes!
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 enterprise manager can execute a query and select 1 million records asynchronously without any problems (also MS-ACCESS).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
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.
您可以尝试 AnyDAC 和 TADTable。其实时数据窗口模式可以解决您的问题和类似的问题。好处是:
You can try AnyDAC and TADTable. Its Live Data Window mode solves your and similar issues. The benefits are: