Is there a DBFactory for DataAdapters in ASP.NET 2.0 / C#?
Posted on 2007-11-21
I have a webpage that creates and fills DataSets using:
string connString = "Dsn=TEST";
string sqlSelect = "SELECT * FROM orders";
OdbcConnection conn = new OdbcConnection(connString);
DataSet dsOrders = new DataSet();
OdbcDataAdapter ad = new OdbcDataAdapter(sqlSelect, conn);
I want to generalize it by being able to pass the ProviderType during runtime so I dont have to change the code to SqlDataAdapter for when I move this to a SQl Server instead of ODBC. Is there a way to do this?