List Info

Thread: Ado stored procedures using parambyname




Ado stored procedures using parambyname
country flaguser name
United States
2007-08-27 02:33:58

HI,
I am using Delphi 7 enterprise OS = Win 2000 Prof

I am trying to to use a Tadostoredproc so I can call its parameters
using parambyname. My code is something like this. This is a generic
Tadostoredproc and I feed it the storedprocedure name via a function.

storedproc.close
storedproc.parameters.clear;
storedproc.procedurename := thenewprocedurename;
storedproc.parameters.refresh;

After refreshing my expectation is that the storedproc knows about the
parameters names ...but it dos'nt and I get an error message when
using storedproc.parambyname['paramname'].value := newvalue

This however, storedproc.Parameters[n].Value := newvalue works as
expected but I wish to use parambyname to make my code more readable.
Am I missing something out ?

best wishes Ed

__._,_.___
Recent Activity
Visit Your Group
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Yahoo! Groups

Moderator Central

Connecting a world

of moderators

Yoga Groups

Find Enlightenment

& exchange insights

with other members

Re: Ado stored procedures using parambyname
country flaguser name
United States
2007-08-27 05:06:28

Hi Ed,

Please find the code below. I hope this is the solution for you problem.

StoredProc.Close;
StoredProc.parameters.clear;
ShowMessage(StoredProc.ProcedureName);
StoredProc.ProcedureName := thenewprocedurename;
StoredProc.Parameters.Refresh;
//StoredProc.Parameters[1].Value := newvalue;

* StoredProc.Parameters.ParamByName(paramname).Value := newvalue;
* StoredProc.Open;
Rashmikant

On 8/27/07, edsynergy < edsynergy%40yahoo.com">edsynergyyahoo.com> wrote:
&gt;
> HI,
> I am using Delphi 7 enterprise OS = Win 2000 Prof
>;
> I am trying to to use a Tadostoredproc so I can call its parameters
> using parambyname. My code is something like this. This is a generic
> Tadostoredproc and I feed it the storedprocedure name via a function.
>
&gt; storedproc.close
&gt; storedproc.parameters.clear;
> storedproc.procedurename := thenewprocedurename;
> storedproc.parameters.refresh;
>
&gt; After refreshing my expectation is that the storedproc knows about the
> parameters names ...but it dos'nt and I get an error message when
>; using storedproc.parambyname['paramname'].value := newvalue
>
>; This however, storedproc.Parameters[n].Value := newvalue works as
> expected but I wish to use parambyname to make my code more readable.
> Am I missing something out ?
>
> best wishes Ed
>
>
>

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity
Visit Your Group
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Cat Fanatics

on Yahoo! Groups

Find people who are

crazy about cats.

Yoga Groups

Exchange insights

with members of

the yoga community.

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )