使用 TADOQuery 查询 TClientDataSet

发布于 2024-08-14 05:12:55 字数 439 浏览 7 评论 0原文

我的问题很简单。我有一个通过 TDataSetProvider 链接到 TADOQuery 的 TClientDataSet。我可以将数据从 TADOQuery 放入 TClientDataSet,但是如何将数据从 TClientDataSet 取回到 TADOQuery?

当我运行查询并将 TClientDataSet 的 Active 属性设置为 True 时,数据会自动从 TADOQuery 传输到 TClientDataSet,但是如果我停用 TADOQuery 然后再次激活它,如何从 TClientDataSet 取回数据?

我在多个数据库上运行相同的查询并使用 TClientDataSet 连接结果。这工作正常。我现在的问题是,我需要将连接的结果集从 TClientDataSet 返回到 TADOQuery 中,以便我可以使用 TADOQuery 的 SaveToFile 过程(出于兼容性原因)。我该怎么做?

My question is very simple. I have a TClientDataSet that is linked to a TADOQuery via a TDataSetProvider. I can put data into the TClientDataSet from the TADOQuery, but how do I get data from the TClientDataSet back into the TADOQuery?

Data is automatically transferred from the TADOQuery to the TClientDataSet when I run a query and then set the TClientDataSet's Active property to True, but if I deactivate the TADOQuery and then activate it again, how can I get the data back from the TClientDataSet?

I am running the same query on several databases and using the TClientDataSet to concatenate the results. This is working fine. My problem now is that I need to get the concatenated result set back from the TClientDataSet into the TADOQuery so that I can use the TADOQuery's SaveToFile procedure (for compatibility reasons). How can I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

分开我的手 2024-08-21 05:12:55

我不像使用 dbExpress 那样使用 TADOQuery,但我想需要使用相同的技术。将更改发布到 TClientDataSet 后,调用“ApplyUpdates (0)”,它将数据从 clientdataset 传输到其提供者。

I don't do TADOQuery as I use dbExpress, but I imagine that one needs to use the same technique. After you have posted your changes to TClientDataSet, call 'ApplyUpdates (0)', which transfers the data from the clientdataset to its provider.

轻拂→两袖风尘 2024-08-21 05:12:55

您始终可以将数据集写回临时表,然后查询它。哎哟!!

You could always write the dataset back out to a temp table and then query it. Ouch!!

提笔落墨 2024-08-21 05:12:55

我刚刚调查完这个。我的应用程序允许用户通过查询数据库来生成报告。我可以让它工作,并且对于小型结果集非常有效 - 但是,由于这是一个报告应用程序,并且完全有可能返回数十万条记录,因此使用 ClientDataSet 会带来巨大的性能问题。一旦您获得超过大约 50,000 条记录(考虑到客户群,这是合理的),处理量就会开始呈指数级增长,因此现在这基本上没有实际意义。

I've just about finished looking into this. My application allows the user to generate reports by querying their databases. I can get this to work and it is very efficient for small result sets - however, as this is a reporting application, and it's entirely possible that hundreds of thousands of records can be returned, using a ClientDataSet gives massive performance problems. Once you get above around 50,000 records (reasonable, given the customer base), processing starts to increase exponentially, so this is now basically moot.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文