Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 244153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:58:51+00:00 2026-05-11T20:58:51+00:00

We need the application we are building to be Database-agnostic. In particular, I need

  • 0

We need the application we are building to be Database-agnostic. In particular, I need it to be able work with SQL Server, Oracle and MySQL. In the future, possibly other DB Vendors will be added to the list. Of course, whatever DB is to be used will have the same schema.

In order to build a prototype to demonstrate the interface, we loaded the schema in an SQL Server DB, and then generated the DataSet and TableAdapters for that database. As the dataset was generated by a specific instance of a database, I suspect that the generated DataSet and TableAdapters are not vendor independent. Furthermore, I am not even sure whether they can be used for another SQL Server DB instance.

My question is this:
Is there a way to use the same auto-generated DataSet and TableAdapters with different databases (and possibly vendors)?

Cheers,

Markos

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:58:51+00:00Added an answer on May 11, 2026 at 8:58 pm

    In general, if you develop your database code against the System.Data.Common namespace, it will be as agnostic as it can be. There are plenty of caveats involved, however, since each database provider has its own particular implementation level details that differ from the rest.

    An example of a database-agnostic approach using System.Data.Common looks like this:

    var factory = DbProviderFactories.GetFactory("My Provider Name");
    using (var connection = factory.CreateConnection())
    {
        connection.ConnectionString = "My Connection String";
        connection.Open();
    
        var cmd = factory.CreateCommand();
        cmd.CommandText = "My Command Text";
        cmd.Connection = connection;
    
        var adapter = factory.CreateDataAdapter();
        adapter.SelectCommand = cmd;
    
        var dataset = new DataSet();
        adapter.Fill(dataset);
    
        // ...
    }
    

    Simply change the first line to switch database providers and the rest of code can pretty much remain the same.

    This approach uses a lot of hand-coding. You might consider using a database framework like NHibernate (as mentioned by David Basarab), Subsonic or the Microsoft Enterprise Library Data Access Application Block to name a few.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building an application which needs to connect to a central MySQL database.
I'm building an application in Java to retrieve data from MySQL database. After executing
I'm building an application with the following criteria: work items: items that need to
I'm building a C++ application and need to use PDCurses on Windows. I'm compiling
in a web application I am building I need to upload photos without using
I'm building a .NET 3.5 application and have the need to evaluate JS code
I'm building a java/spring application, and i may need to incorporate a stateful web
In an application I need to execute other programs with another user's credentials. Currently
I'm building an application and need a data structure of interconnected objects that can
We are building an application that may need to be replicated to many servers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.