Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello there,


Please let me explain my situation and my needs:
- 2 databases in 2 seperate folders (Testing / productive data)
- 1 dataset (path from settings)

Environment:
VS2008, C#3.5

Now i want to choose / configure the path to the database depending
on the active solution configuration (Debug / Release / ...)

Anyway is it possible at all?
Does anybody know how to achive this?


Thanks in advance!

ToniM
Posted

I cannot post a comment, so i post a answer! ;)


At first im not familiar with the interaction of settings.settings and app.config and the dataset.xsd. Can you explain it to me?
Why is there in both files the same configuration string? and if you change it only in the App.config there is a problem when you open the settings file.
I can not get behind it ... :confused:

The settings file is in the Properties -> it will be compiled into the binary -> i cannot change in output folder.
(If you change just the app.config i expect an error, mentioned above)
 
Share this answer
 
Comments
Johnny J. 21-Sep-10 4:45am    
That's true - my mistake. I will remove my hastily composed and ill-thought out answer immediately...
I found at least a workaround - if somebody has a better way, please let me know!
here is my solution:

I put everything (DataSets, TableAdapters, TableAdapterManager) into a singleton wrapper class and provide those DataSets, TableAdapters and TableAdapterManager through properties.

In the constructor i update the ConnectionString of each TableAdapter (TableAdapter.Connection.ConnectionString) depending on my needs.
I need a productive and a test database, so i set the test path as default (in the DataSet designer) and just change it when its a productive deploy.

Im sure its not the best solution, but it works until i find out or somebody tell me a better way.


ToniM
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900