Is it possibly to specify store procedure parameters by position instead by name?

S

SammyBar

Hi,

I'm developing a new .NET application but using the same stored procedures
(Sql Server 2000) that are in use by an old client server application. The
problem is that it is common when refactoring stored procedures, to change
the name of the parameters. It was not a problem since the old application
uses ODBC and the parameters are called by position, not by name. But
ADO.NET requires to me to specify parameters by name
parm = cmd.Parameters.Add("@ParamName", SqlDbType.Int);

Then when the sp get revised and updated to our new coding standard
(@ParamName will be renamed to @nParamName) it will break my code.

Is it any way I can specify the parameters by position, something like:

parm = cmd.Parameters.Add(0, SqlDbType.Int);

Any hint is welcomed.

Thanks in advance

Sammy
 
W

William \(Bill\) Vaughn

Not really unless you roll the EXEC mySP parm,parm2 line yourself.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top