Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you change a typed datasets provider?

Using C# I have created a dataset using vs2010. I added tables and table adapters by dragging and dropping from a SQL server data table.

I want to use that created dataset's table but connect to an access database. How can I do that?

What I'm trying to do here is make one app that can connect to a sql database or an access database that use the same data sets with data tables. Is this even possible?

like image 571
user1304232 Avatar asked Aug 06 '13 19:08

user1304232


1 Answers

I agree with @Phrancis... My recommendation is sql express user instance instead of access. This would enable seamless switching. Follow the example posted by @Brij Raj Singh from codemonk to implement Application level connection strings and you will be set.

But if you still want to do it:

  1. Make sure your databinding is done in code and not visually.
  2. Duplicate your dataset, connecting it to Access
  3. create a factory to provide your datasets as datasources
  4. use the factory to get your datasources when binding
  5. Implement choice at app startup, and pass this choice along to factory class so it can provide the correct datasource
like image 131
weePee Avatar answered Sep 21 '22 00:09

weePee