Mulitple Tables returned by StoredProcedure in UNIQuery

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
krshin
Posts: 14
Joined: Wed 21 Mar 2007 11:29

Mulitple Tables returned by StoredProcedure in UNIQuery

Post by krshin » Thu 09 May 2013 10:19

Hello,

We have plans to migrate our database connectivity from dbExpress to UniDAC but in yours trial mode everything look good, but on tests with SQL Server when we have more than one table in returning value we can see only first result set, all the others were ignored by UniQuery component.

Is this scenario is possible with UniDAC components? :shock:

Thank for help in advance...

AndreyZ

Re: Mulitple Tables returned by StoredProcedure in UNIQuery

Post by AndreyZ » Mon 13 May 2013 13:11

Hello,

To get the next result set, you should use the OpenNext method. Here is a code example:

Code: Select all

UniQuery.SQL.Text := 'select * from table1; select * from table2';
UniQuery.Open; // the first result set (table1)
UniQuery.OpenNext; // the second result set (table2)

krshin
Posts: 14
Joined: Wed 21 Mar 2007 11:29

Re: Mulitple Tables returned by StoredProcedure in UNIQuery

Post by krshin » Fri 07 Jun 2013 13:44

Hello AndreyZ,

Sorry I didn't saw that you were answered to my post.
I try with yours sample, with UniQurery and UniStoredProc but I have error, probably is that because I want to made two selection into one dataset. That is great option OpenNext, but if you have one more minute for one aditional question.

When I have scenario with more than one result set, can I connet another results to datasource components and to procees data like in standard case (just readin data)?

Thanks in advance for help ...

AndreyZ

Re: Mulitple Tables returned by StoredProcedure in UNIQuery

Post by AndreyZ » Mon 10 Jun 2013 06:37

If you return several result sets in one query, you can work with them only sequentially, one by one. It means that when you open TUniQuery (TUniQuery.Open), the linked datasource component will show the first result set. After calling TUniQuery.OpenNext, the linked datasource component will show the second result set.

Post Reply