ADO.NET: named parameter or unnamed, use ? or @, even % [ ]

R

Ryan Liu

Does ADO.NET unified the way to use parameters in sql query string?

No matter what database server or driver are being used, can ADO.NET layer
supports so called named or unnamed parameters? And defines fixed parameter
marker character? Does ANSI SQL define rules for parameter marker?

That way, maybe easier to develop application works with most database
server.

Thanks,


~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

Ryan Liu
Shanghai Fengpu Software Co. Ltd
Shanghai , China

http://www.PowerCATI.com Powerful CATI!
http://www.fpsoft.net.cn
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
 
M

Marc Gravell

I suspect it is down to the specific provider to care about the
structure. For instance, IIRC, the SqlClient provider *only* supports
named parameters (not 100% sure, but just seem to recall...)

Marc
 
A

Arne Vajhøj

Ryan said:
Does ADO.NET unified the way to use parameters in sql query string?

No matter what database server or driver are being used, can ADO.NET
layer supports so called named or unnamed parameters? And defines fixed
parameter marker character? Does ANSI SQL define rules for parameter
marker?

4 x No

You will have to parameterize that yourself (it is not that difficult).

Arne
 
N

Nicholas Paldino [.NET/C# MVP]

Un addition to the other answers, you might want to look at the data
access enterprise block. The Database class has a property on it that
indicates what the parameter marker is for a particular database provider.
 

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