Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2007-11-21
1
Medium Priority
?
737 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
SQL_SERVER_DBA earned 2000 total points
ID: 20329683
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

730 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