0

I have written an application that allows a user to define a query, run it using a TADOQuery component, and save the report to their PC as an XML document (SaveAsFile passing in pfXML as the Format parameter) for offline viewing. This works fine.

What I now need to do is concatenate the results. What I mean by this is that I need to get at least two reports (with identical fields as they are using the same query) and join them together to make one report. For example: Say I have a query that retrieves a list of users. I run this query on "System A" and "System B" where System A and System B are two separate systems. Once I have run the query on both systems, I have two separate report files, which I can load back into a TADOQuery component and then view on screen. What I need to do though is join the reports together, so instead of having to switch between the two reports, I can see all the results on screen at the same time.

I have been told that I can do this using a TClientDataSet but I'm relatively new to database programming and have no idea where to start with this. I've checked out the articles at http://delphi.about.com/od/usedbvcl/a/tclientdataset.htm but I'm still in the dark as nothing seems to do exactly what I need it to do.

I therefore have two questions: 1. Is using a TClientDataSet the best way to take two separate result sets and concatenate them? If there is a better way to do this, what is it? 2. If using a TClientDataSet is the best way to do this, how exactly would I go about doing this? How do you transfer data from a TADOQuery into a TClientDataSet and then back again? The basic flow of the processing needs to go something like this:

Report 1 (LoadFromFile) -> TADOQuery \

                                  ClientDataSet -> TADOQuery -> SaveToFile

Report 2 (LoadFromFile) -> TADOQuery /

All help would be appreciated on this. I really don't know where to start!

4

1 回答 1

0

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

于 2009-12-07T17:15:44.263 回答