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

dmitry boyarintsev skalogryz.lists at gmail.com
Fri Apr 19 05:47:50 CEST 2013


Hello Toru,

Not sure if it works with SQLdb or ADO, but it has been working for some
other tasks that I've been involved with (not FPC, but delphi based,
though).

You can have the result as through the select statement.
Have a TSQLQuery to run the following query:

SET NOCOUNT ON
declare @var1 int; -- whatever type of the out parameter you need.
exec YourStoredProc  @outvar = @var1 output
select @var1 as var1

then
var q: TSQLQuery;
 i:integer;
...
q.Active:=true;
if not q.eof then
  i:=q.FieldsByName('var1').asInteger;

Hope that helps.

thanks,
Dmitry

On Wed, Apr 17, 2013 at 11:45 PM, Toru Takubo <takubo at e-parcel.co.jp> wrote:

> Hi All,
>
> I have an application build with Delphi7+ADO connecting
> to MSSQL database, and planning to migrate to FPC+SQLdb.
>
> It has many stored procedures which have OUT parameters
> to retrieve value from database. I am trying to migrate
> by using TMSSQLConnection+TSQLQuery, but still I can not
> settle it. I can execute and pass values to stored procedures,
> but not the other way. The RETURN_VALUE (default result)
> can not be retrieved either.
>
> I would appreciate any advice.
>
> Toru
>
>
>   _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130418/0709a5e9/attachment.html>


More information about the fpc-pascal mailing list