2

I am developing an application. Client wants application to run on two databases, SQL Server Compact Edition and SQL Server.

Now the problem is in Visual Studio in dataset you have to program twice for different database.

That will double my work. Is there any way I could use same dataset and datatable code to interact with both the objects?

2
  • rajmsdn.wordpress.com/2009/12/09/… Commented Apr 12, 2012 at 14:47
  • Sorry, mistype. Any ORM, for example use Entity Framework, or try using LINQ ORM, it's like a data layer between you and DB. Commented Apr 12, 2012 at 14:59

1 Answer 1

2

By using DbProviderFactories (see http://msdn.microsoft.com/en-us/library/wda6c36e.aspx) it's possible to specify provider in the connection string and write code that works with multiple providers (different databases).

Then make sure that your code uses base classes such as DbConnection and DbDataReader instead of provider specific classes like SqlConnection and SqlDataReader.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.