Re: Parameterized queries to different data providers



Hi Dino,

I don't think that there is an easy solution other than doing naming based
on provider manually.
Perhaps you might look into ORM products that do that part for you?

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Dino Buljubasic" <dino@xxxxxxxxxxxxxxxxxxx> wrote in message
news:faepo1t9vt5nqnp3bu3joc11ku0gal646u@xxxxxxxxxx
> Hi,
>
> I would like to build my app so it can connect to SQL Server, Oracle
> or mySQL and query data.
> Data queries should be parameterized to reduce impact of SQL
> Injection.
>
> SQLServer Dataprovider uses named parameters (i.e. @name)
> OracleClient Dataprovider uses named parameters (i.e. :name)
> mySQL ODBC Dataprovider uses question marks (i.e. ?) on the place of a
> parameter (so order of question marks is important)
>
> How do I write my queries easily so they will work with all 3 of these
> data providers?
>
> For example how do I write this to work with all tree:
>
> SELECT a1, a2 FROM table1 WHERE a1 = 'blah' AND a2 = 'blahblah'
>
> thank you
> _dino_


.



Relevant Pages

  • Re: Parameterized queries to different data providers
    ... This is why it is virtually impossible to write one code base that works for ... > OracleClient Dataprovider uses named parameters ... > parameter (so order of question marks is important) ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Parameterized queries to different data providers
    ... > Data queries should be parameterized to reduce impact of SQL ... > OracleClient Dataprovider uses named parameters ... > parameter (so order of question marks is important) ...
    (microsoft.public.dotnet.framework.adonet)

Loading