Note that there are some explanatory texts on larger screens.

plurals
  1. PODelphi ADOQuery result concatenation using ClientDataSet
    text
    copied!<p>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.</p> <p>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.</p> <p>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 <a href="http://delphi.about.com/od/usedbvcl/a/tclientdataset.htm" rel="nofollow noreferrer">http://delphi.about.com/od/usedbvcl/a/tclientdataset.htm</a> but I'm still in the dark as nothing seems to do exactly what I need it to do.</p> <p>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:</p> <p>Report 1 (LoadFromFile) -> TADOQuery \</p> <pre><code> ClientDataSet -&gt; TADOQuery -&gt; SaveToFile </code></pre> <p>Report 2 (LoadFromFile) -> TADOQuery /</p> <p>All help would be appreciated on this. I really don't know where to start!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload