Subject Re: [firebird-support] Getting return value from stored procedure using Qt QSqlQuery
Author Peter Lee
Hi Tom,

After you call the exec() on the query, make sure you to a .next() or
.first() to get onto the first record.... you can also check .isValid()
after that to see if you've got a valid record at all.

Regards,

Peter Lee

Alan McDonald wrote:
>> On Tue, 20 Nov 2007, Alan McDonald wrote:
>>
>>>> Using FB 2.0.3 on Gentoo, Qt 4.3.2
>>>>
>>>> I have a stored procedure that takes a number of input parameters
>>>> and a single return value (which happens to be the Id of
>>>>
>> the record
>>
>>>> affected).
>>>>
>>>> I am calling this procedure using Qt QSqlQuery with the following
>>>> SQL:
>>>>
>>>> execute procedure "AddFixtures" param1, param2, paramm3 etc
>>>>
>>>> The SP executes OK but I can't figure out how to get the return
>>>> value - I've tried every combination I can think of based
>>>>
>> on the Qt
>>
>>>> help information.
>>>>
>>>> Can someone please point me in the right direction?
>>>>
>>>> Regards
>>>> Tom Munro Glass
>>>>
>>> Not knonwing Qt I will have to guess that it does not
>>>
>> provide return
>>
>>> values What you should use instead is a selectable SP call Eg.
>>> SELECT id FROM AddFixtures(param1, param2, paramm3);
>>> And use it in a normal query
>>> Alan
>>>
>>>
>> Thanks for the suggestion, but I've tried that and get the
>> following error
>> when I try to read back the value:
>>
>> QSqlQuery::value: not positioned on a valid record
>>
>> Regards
>> Tom
>>
>
> You'll have to show us the SP source, maybe you are using exit instead of
> SUSPEND
> Alan
>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>

--
Peter Lee ptle@...
-----------------------------------------------------------------------
Rising Software Australia Pty. Ltd. http://www.risingsoftware.com/
Publishers of 'Auralia' - Ear Training and 'Musition' - Theory Training
Ph: +61 3 9481 3320 FAX: +61 3 9481 3380 USA Freecall: 1 888 667 7839