Page 1 of 1

Mulitple Tables returned by StoredProcedure in UNIQuery

Posted: Thu 09 May 2013 10:19
by krshin
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...

Re: Mulitple Tables returned by StoredProcedure in UNIQuery

Posted: Mon 13 May 2013 13:11
by AndreyZ
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)

Re: Mulitple Tables returned by StoredProcedure in UNIQuery

Posted: Fri 07 Jun 2013 13:44
by krshin
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 ...

Re: Mulitple Tables returned by StoredProcedure in UNIQuery

Posted: Mon 10 Jun 2013 06:37
by AndreyZ
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.