Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2007-11-21
1
Medium Priority
?
743 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 2000 total points
ID: 20329683
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

972 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