Board index » delphi » StoredProcs

StoredProcs

I am using Delphi 5 and SQL server 6.5  I use a TStoredProc component in
Delphi to access my stored procedures and everything works fine except that
I cannot have both a DataSet and Output Parameters at the same time after
executing a stored proc. As soon as the procedure returns a DataSet it seems
that Delphi ignores the output parameters though SQL returns them normally !
When I return no DataSet I get back my output parameters.
Can somebody please help
 

Re:StoredProcs


In article <3b61a05e_1@dnews>, ghila...@usa.net says...
Quote
> I am using Delphi 5 and SQL server 6.5  I use a TStoredProc component in
> Delphi to access my stored procedures and everything works fine except that
> I cannot have both a DataSet and Output Parameters at the same time after
> executing a stored proc. As soon as the procedure returns a DataSet it seems
> that Delphi ignores the output parameters though SQL returns them normally !
> When I return no DataSet I get back my output parameters.
> Can somebody please help

Use ADO. Here's a code snippet.

This stored procedure retrieves a row from a table determined by a
parameter, @id, and returns an output parameter, @msg.

with ADOStoredProc1 do
  begin
    Close;
    Parameters.ParamByName( '@id' ).Value := StrToInt( edMem.Text );
    ExecProc;
    Open;
    edRet.Text := Parameters.ParamByName( '@RETURN_VALUE').Value;
    edMsg.Text := Parameters.ParamByName( '@msg' ).Value;
  end;    // with

Re:StoredProcs


This is because of MSSQL anomaly and BDE is not aware of it:
output parameters are returned *after* fetching result set. So, you just
execute .Last method, and you'll have output parameters.

--
Robert

Quote
Grgory Hilaire wrote in message <3b61a05e_1@dnews>...
>I am using Delphi 5 and SQL server 6.5  I use a TStoredProc component in
>Delphi to access my stored procedures and everything works fine except that
>I cannot have both a DataSet and Output Parameters at the same time after
>executing a stored proc. As soon as the procedure returns a DataSet it
seems
>that Delphi ignores the output parameters though SQL returns them normally
!
>When I return no DataSet I get back my output parameters.
>Can somebody please help

Other Threads