Solved

Is there a DBFactory for DataAdapters in ASP.NET 2.0 / C#?

Posted on 2007-11-21
1
732 Views
Last Modified: 2013-11-07
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);
    ad.Fill(dsOrders, "Orders");

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?
0
Comment
Question by:bemara57
1 Comment
 
LVL 16

Accepted Solution

by:
SQL_SERVER_DBA earned 500 total points
ID: 20329683
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question