SQL Server, Oracle, MySql, OleDb, Parameterized Queries and ADO.NET

Posted by Blake on 1/9/2012

One thing that irks me is the prefix qualifier that is used in various ADO.NET provider implementations. I’m not sure why they all need to be different but alas, they are. :P This means, depending on what provider you use, you could have two different drivers for the same database with two different qualifiers. Having the framework generic sql for you will help with this, but I like writing my own.

Anyway, for reference, when using parameterized queries, here’s the qualifiers:

  • SqlServer “@” (Using SqlClient)
  • SqlSeverCompact “@”
  • MySql “?” (Using the MySql Connector)
  • Oracle “:” (Using Oracle’s ADO Client, not the deprecated version MS used to support)
  • OleDb: “?” (I’ve read this is supposed to be supported on most OleDb providers, but I know for a fact that you can use @ with MSACCESS/OleDb, obviously you’ll need to research more obscure implementations).