[fpc-pascal] Re: How can retrive value from OUT parameter?
Toru Takubo
takubo at e-parcel.co.jp
Sat Apr 20 05:01:15 CEST 2013
(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.
Toru
More information about the fpc-pascal
mailing list