Re: Generic ADO Code to run a stored Proc



In article <44634119$1@xxxxxxxxxxxxxxxxxxxxxx>,
martin.scullion@xxxxxxxxxxxxx says...

Hi There

I am trying to work out a way to run a stored proc
thru ADo where the amount of params, values, types
etc etc are completely unknown.

My first Idea was to create a proc with 2 params
S/P name & a TParameters collection object, I could
then pass this lot down into the procedure body,
walk the TParameters object and try to load up the
S/P objects own TParameters object and run the S/P.

Sounds reasonably sensible, but unfortunately I come
from a VB6 background & am battling with how to do
this esp the TParameters object creation.

Also If anyone has a much simpler idea, please feel
free to tell me I'm a VB incompetent who shouldn't be
let anywhere near delphi.

One other thing I'm using Delphi 5.

Many thanks.



do it like we do:

Use a TADOQuery and ,in your beforePost,
use the Format command to modify the SQL
like this:

sSQL := 'EXECUTE YourSPName %s';
sSQL := Format(sSQL, ['string of paramters']);
ADOQuery1.Sql.Text := sSQL;
ADOQuery1.ExecSQL;
// or use .Open if you want it to return values.


.