Hi..
You should use something like:

 private static DbProviderFactory factory;
        private static DbConnection cnn;

        private static void getFactory()
        {
            if (factory == null)
            {
                factory =
DbProviderFactories.GetFactory(ConfigurationManager.ConnectionStrings["CONN"].ProviderName);
                cnn = factory.CreateConnection();
                cnn.ConnectionString =
ConfigurationManager.ConnectionStrings["CONN"].ConnectionString;
            }
        }


...
Alex

2010/12/3 Stephen Russell <[email protected]>

> On Fri, Dec 3, 2010 at 7:08 AM, Jamie Fraser <[email protected]>
> wrote:
> > Please, don't use code like that.
> > If you really must provide the ability to change DB providers, then as
> > mentioned (several times) you should be using something like NHibernate
> or
> > another ORM provider.
> -------------------------
>
> AMEN!
>
>
>
> --
> Stephen Russell
>
> Sr. Production Systems Programmer
> CIMSgts
>
> 901.246-0159 cell
>



-- 
Att.
Alex Vidotto

Reply via email to