Oracle vs SqlServer parameters

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi;

When I create an IDbCommand.CommandText select string, all of the examples
show using @name for SqlServer substitution and :name for Oracle substitution.

I don't know Oracle well so I may be doing something wrong. But it appears
that you must use the required character in each case. Is this true? If so,
it makes select statements totally non-portable in .NET
 
David Thielen said:
Hi;

When I create an IDbCommand.CommandText select string, all of the examples
show using @name for SqlServer substitution and :name for Oracle
substitution.

I don't know Oracle well so I may be doing something wrong. But it appears
that you must use the required character in each case. Is this true? If
so,
it makes select statements totally non-portable in .NET

Basically, yes. I use @ for all my parameter markers, and preprocess all my
Oracle queries to replace '@' with ':'

David
 
Hi Dave,

As David mentioned, we have to use different parameter markers for
different providers. Actually, this is by design with the database. As
Oracle requires a : and SQL server requires a @ for the prefix of a
parameter name. HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top