Re: stored proc RETURN_VALUE.... there it is, I want to use it !!!
- From: "Betsy" <betsy.a.tainer@xxxxxxxxxxxxx>
- Date: Wed, 27 Apr 2005 13:11:04 -0700
I've since eliminated my attempt to 'return' a value and just going after
the result set... and have found I'm having a problem with that... I'm
thinking that there is something amiss in my component property or with the
connection ???? I'm pulling my hair out here! (the cleaning lady hates it
when I do that... it's about 2 feet long, gums up the vacuum cleaner)
b
"Ron" <noone@xxxxxxxxxxx> wrote in message
news:426fe2af$1@xxxxxxxxxxxxxxxxxxxxxxxxx
> 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
> >
> >
>
>
.
- References:
- Prev by Date: Re: Cannot Connect ADOConnection at Run-Time
- Next by Date: Re: stored proc RETURN_VALUE.... there it is, I want to use it !!!
- Previous by thread: Re: stored proc RETURN_VALUE.... there it is, I want to use it !!!
- Next by thread: Re: stored proc RETURN_VALUE.... there it is, I want to use it !!!
- Index(es):
Relevant Pages
|