Re: RETURN_VALUES ??? done... What have I gained?



What's the real question ?? is one more efficient than the other ?? If the
database is not properly tuned then it doesn't matter which you use, all
efficiency might be lost by thrashing the db.
tAdoDataSet is really easy to use. You can set the commandtext to standard
sql statement or point to a stored procedure. Eitherway, you "open" the
dataset even though you are pointing to a stored procedure. The stored
procedure can be as simple as "select sum(x) where .." or it can be a hugh
join with unions and cross db joins etc, which could result in one row or
one column or a gazillion rows. When you use a tADOStored procedure, it is
usually because the storded proc itsself is doing something and you dont
need a result set, you just want to know if it was successful or not. On the
surface, if you want data, do a tadodataset , if you want the strored
procedure to do it's thing and tell you it is ok, then do a tadostoredproc.
But dont use a stored proc return code to return data .... data is not a
return code, it is data, and return codes are not data, they are return
codes. That way the person comming behind you will see a tAdodataset and
know that you are retrieving data (even if it is 1 row, 1 column) and they
will be better able to understand what you are trying to do. Doctor Codd
would frown on you using a stored procedure return code to get the sum of an
amount column. He would rather you use a stored procedure to execute a
precompiled sql statment which returns in a recordset, the answer that you
need.

"Betsy" <betsy.a.tainer@xxxxxxxxxxxxx> wrote in message
news:427aa075@xxxxxxxxxxxxxxxxxxxxxxxxx
> General question...
>
> -using an ADOSTOREDPROC component... is there any reason why I should use
> something else, say ADOQuery ???? With adodataset I was getting an error
> about a result set and didn't see anywhere where I had the opportunity to
> Execproc vs Open... (did I miss something there?)
>
> -the only advantage I see is that I'm not trying to return a dataset when
> all I need is a stinkin value, amount, string, what-have-you... there is
> nothing especially clean and simple about it... so... (the question)
> (FINALLY!)... Did I really gain anything??? (other then some tiny sense of
> accomplishment)
>
> That is a serious question by the way... is it somehow more effecient to
> retrieve one value/result when that is all you need?
>
> ***for the inquiring mind***
> stored proc:
> CREATE PROCEDURE dbo.getPayments @meetingCode char(6), @guestID char(10),
> @total money OUTPUT AS
> /* used to retreive the payments made by a member*/
> select @total = sum(amount)
> from payments
> where (meetingCode= @meetingCode) and (guestid = @guestid)
> RETURN
> GO
>
> call in a function:
> function Tdm.GetPayments: currency;
> begin
> result := 0.00; //default
> if adodsMeeting.Active then //a meeting is opened
> begin
>
> with ADOSP do
> begin
> close;
> Prepared := false;
> Parameters.Clear;
>
> ProcedureName := 'getPayments';
>
> Parameters.CreateParameter('meetingCode',ftString,pdInput,6,
> trim(adodsGuests.Fieldbyname('meetingCode').AsString));
> Parameters.CreateParameter('guestID',ftString,pdInput,10,
> trim(adodsGuests.Fieldbyname('guestid').AsString));
> Parameters.CreateParameter('total',ftCurrency,pdOutput,10,0);
>
> prepared := true;
> ExecProc;
>
> if varisnull(Parameters.ParamByName('total').Value) then
> result := 0.00
> else
> result := Parameters.ParamByName('total').Value;
> end;
> end;
> end;
>
>
> ps... thanx Ron noone@xxxxxxxxxxxxxx your notes helped tremendously... I
> find microsoft help to be a little criptic.
>
>


.



Relevant Pages

  • Re: Update statement performance decreases in stored proc
    ... Have you had a look at the execution plan of the stored procedure? ... Here are the important parts of the stored proc: ... I found that this was casued by the UPDATE statement at the end ...
    (microsoft.public.sqlserver.programming)
  • Re: RETURN_VALUES ??? done... What have I gained?
    ... b (aka whipper-snapper) ... > similar questions via stored proc and can set up a function to do the work ... >> tAdoDataSet is really easy to use. ... >> dataset even though you are pointing to a stored procedure. ...
    (borland.public.delphi.database.ado)
  • Re: RETURN_VALUES ??? done... What have I gained?
    ... Who is Doctor Codd? ... similar questions via stored proc and can set up a function to do the work ... > tAdoDataSet is really easy to use. ... > dataset even though you are pointing to a stored procedure. ...
    (borland.public.delphi.database.ado)
  • TableAdapter, INNER JOINs, stored procs, and problems with Update
    ... I have a stored procedure that uses JOINs to return columns from multiple ... I also have another stored proc that that takes a series of params ... @ac2 int, ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Repost - Sql Server 2005 - SSIS - nbr of input cols < nbr stored proc parameters (MS
    ... proc parameters ... | file and insert them into an existing table using an 'insert stored proc' ... | inputs for all the stored proc parameters but the flat file only contains ... | and a stored procedure that inserts records into our lkp_county table ...
    (microsoft.public.sqlserver.dts)