I have a C # application that we encoded in ADO.NET. I use the IDbCommand and IDbConnection to generate cross-database code.
All this has worked so far (via Firebird, SQLite, SQL Server 2005 and 2008, Access 2007 and Access 2010 and Oracle 11g).
I have a problem: I now have an Oracle 10g database that I need to maintain.
All the โnormalโ things that make connections and commands work fine, however, when I go to create a parameter using the IDataParameter and cmd.CreateParamater() interfaces, it fails at 10g due to the syntax of the parameter in the request (I 'using parameterized queries).
Apparently, Oracle 10g, out of the box, does not support the use of the @ sign. Oracle 11g, SQL Server and all the others mentioned above.
For example, the following request will fail in 10g:
select * from Products where ProductId = @ProductId
But, if I use a colon, it does a great job using the above ado.net interfaces, so this request will succeed:
select * from Products where ProductId = :ProductId
Unfortunately, the colon does not work in most other database implementations.
Or there is an option that can be turned over in the Oracle 10g database, which allows you to use the @ separator instead of the separator : for parameters.
The current solution that I have is less than ideal, I have a client / client initializing the ParameterDelimiter property (which I have an @ sign by default) and use string.Format to insert ParameterDelimiter .
Is there any standard way to do this that I am missing without the client passing me a delimiter or not knowing that my base libraries are aware of the database implementation? (For example, including ODP.NET and OracleConnection )