Re: stored proc RETURN_VALUE.... there it is, I want to use it !!!



Hi Betsy,

I think you have to call close BEFORE reading the return value.
So your code should be
<snip>
close;
getPayments := Parameters.ParamByName('RETURN_VALUE').Value;
<snip>

HTH

Ron.

"Betsy" <betsy.a.tainer@xxxxxxxxxxxxx> wrote in message
news:426eab87$1@xxxxxxxxxxxxxxxxxxxxxxxxx
> so... here I have a stored procedure...
>
> CREATE PROCEDURE dbo.getPayments @meetingCode char(6), @guestid char(10)
AS
> return (select sum(a.amount) as payments from dbo.payments a
> where (A.meetingCode= @meetingCode) and (a.guestid = @guestid)
> group by a.guestid
> )
> GO
>
> here I call it...
> with ADODataSet1 do
> begin
> prepared := false;
> CommandType := cmdStoredProc;
> CommandText := 'getPayments';
> Parameters.CreateParameter('guestID',ftString, pdInput, 10,
> adodsGuests.FieldValues['guestid']);
> Parameters.CreateParameter('meetingCode',ftString, pdInput, 6,
> adodsGuests.FieldValues['meetingCode']);
> Parameters.CreateParameter('RETURN_VALUE',ftCurrency, pdOutput, 4,
0);
> prepared := true;
> open;
> getPayments := Parameters.ParamByName('RETURN_VALUE').Value;
> close;
> end;
>
> I'm anticipating the 'return' of the stored proc to be available in the
> 'RETURN_VALUE' of the dataset parameter.
>
> ***
> I know that I could just run it and read the resulting fieldvalue... never
> mind all of this return() and return_value business... but I saw it there
> and want to use it (whine!). Am I just not thinking clearly? I saw in
the
> sql help that it states that stored procedures don't return values??? But
> then I see that there is the 'return' ?call? available that is suppose to
> return a value...??? and I see the 'RETURN_VALUE' output parameter that
just
> kind of plunks itself there whenever you use a stored procedure... and I'm
> thinking... here's a handy little gizmo, I should figure out how to make
use
> of it... failing miserably... can anyone set me straight?
>
> AND... how come when I plunk down a stored procedure or set my dataset
> component to call a stored procedure that it knows the parameters BUT when
I
> change the name of the stored procedure during runtime I have to 'create'
> the parameters? Am I missing something there as well? (whine again...
they
> need to turn on the air conditioning here, sorry!)
>
> thanx much!
> b
>
>


.



Relevant Pages

  • stored proc RETURN_VALUE.... there it is, I want to use it !!!
    ... Parameters.CreateParameter('meetingCode',ftString, pdInput, 6, ... 'RETURN_VALUE' of the dataset parameter. ... kind of plunks itself there whenever you use a stored procedure... ... component to call a stored procedure that it knows the parameters BUT when I ...
    (borland.public.delphi.database.ado)
  • Re: Cannot add the data into the table
    ... and the rowcount is returned as a return value, ... You can fix this by changing the stored procedure as follows: ... My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis ...
    (microsoft.public.sqlserver.mseq)
  • Re: stored proc RETURN_VALUE.... there it is, I want to use it !!!
    ... >> Parameters.CreateParameter('meetingCode',ftString, pdInput, 6, ... >> 'RETURN_VALUE' of the dataset parameter. ... >> kind of plunks itself there whenever you use a stored procedure... ... how come when I plunk down a stored procedure or set my dataset ...
    (borland.public.delphi.database.ado)
  • Re: Floats become decimals when read from a resultset.
    ... A couple of clarifications are necessary here. ... familiar with the framework.bean.DataAccess package. ... you're actually executing a stored procedure then you're comparing ...
    (comp.lang.java.programmer)
  • Checkboxlist - inserting values into tables
    ... created a stored procedure that handles the insert on two of the tables ... the SomeID2 values for each row. ... on this one for hours -- I'm to the point where I'm just going round 'n round. ...
    (microsoft.public.dotnet.framework.aspnet)