[fpc-pascal] Re: How can retrive value from OUT parameter?

Reinier Olislagers reinierolislagers at gmail.com
Sat Apr 20 09:15:54 CEST 2013


On 20-4-2013 5:01, Toru Takubo wrote:
> (2013/04/19 18:53), Reinier Olislagers wrote:
>> On 19-4-2013 9:26, Toru Takubo wrote:
>>> With analogical thinking, I expected that the following might work
>>> for TSQLQuery in FPC:
>>>
>>> var
>>>    r,i: Integer;
>>>    DBQ: TSQLQuery;
>>> begin
>>> ...
>>>     DBQ.SQL.Text:='IncValue :@Param';
>>>     DBQ.Params.CreateParam(ftInteger,'@RETURN_VALUE',ptResult);
>>>    
>>> DBQ.Params.CreateParam(ftInteger,'@Param',ptInputOutput).AsInteger:=3;
>>>     DBQ.ExecSQL;
>> ExecSQL executes SQL and does not return a value.
>> Try DBQ.Open to return values. No idea if the mssqlconn connector
>> supports output parameters in SPs though; best to just try.
>>
> Hi Reinier,
> 
> I changed the SQL statement to 'EXEC IncValue :@Param' to avoid
> error, and tried DBQ.Open, but the result was the same.
> 
> I suppose OUTPUT parameter is not "result set" but something
> like reference parameter (not exactly though). Actually I use
> both ExecSQL/Open according to whether the stored procedure
> return result set (include select statement) or not.
> 
> Anyway, thank you for your suggestion and docs link.
> 
Thanks for the update, Toru, will have a look if I have time....



More information about the fpc-pascal mailing list