Board index » delphi » Stored procedure returning output parameters

Stored procedure returning output parameters

Hi,

Which is the best Delphi ADO component to use to utilise an SP that returns
output parameters?

Up to now, I've only dealt with SP's returning a result dataset: I use
TADODataSet for these.

If I use TADODataSet for an SP that only returns output parameters, with the
.ExecuteOptions property set to 'eoExecuteNoRecords', when I set .Active
'True', I get the error message:-

'Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another'

However, if I clear .ExecuteOptions, with exactly the same parameters
settings, the component shows the correct values in the output parameters,
then immediately displays the error message:-

'[Dataset.Name]: CommandText does not return a results set'

I'm using D6.02 Ent accessing SQL Server 2000.

Thanks in advance for any assistance.

Regards,

Stuart

 

Re:Stored procedure returning output parameters


Hi Marc,

Thanks for replying.

Quote
"Marc Scheuner" <mscheu...@no.spam.for.me.ca> wrote in message

news:3k4smuof2luamagif1a4n5n7cdhbvo9me5@4ax.com...

Quote
> On Thu, 29 Aug 2002 11:26:40 +0100, "Stuart"
> <stuart....@talk21spam.com> wrote:
> >Which is the best Delphi ADO component to use to utilise an SP that
returns
> >output parameters?

> TADOStoredProc, I'd say...... it's really just a thin wrapper around
> TCustomADODataSet, but it makes life for you as the programmer a bit
> easier, in my opinion.

Fwiw, I used TADODataSet to make life easier :)  The idea was, particularly
when debugging, that a TADODataSet could either point to a SP, or could hold
the SQL locally, in the same component (thus no compile errors due to
changed component names :)  ). In practice, of course, it turned out to be
somewhat more complicated, as pointing TADODataSet at a SP doesn't set up
.Parameters correctly ... which took some time and some hair-tearing to work
out. :)

Quote

> If the stored proc doesn't return any rows of data, use the .ExecProc
> method instead of  .Open (or .Active := True).

Ok, I'll try that. I was actually hoping for something that worked without
errors at design-time - being able to set up the component, set .Active
'True' and have it 'work' is a useful aid, as I'm sure you'll agree.

Thanks again for your help.

Regards,

Stuart

Re:Stored procedure returning output parameters


Quote
>Which is the best Delphi ADO component to use to utilise an SP that returns
>output parameters?

>Up to now, I've only dealt with SP's returning a result dataset: I use
>TADODataSet for these.

For SQL code that does not return a recordset TadoCommand is the best component
to use.
--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Stored procedure returning output parameters


Thanks for all the help.

Regards,

Stuart

Other Threads