Hello all< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
I use typed datasets, and the adapters which created for each table, it is very convenience.
But...
The application is targeted to be distributed to my clients which has a different connection string than I do.
How do I change the connections string dynamically
Please do not give me one of the next answers:
I already know that the connection string in the app config is read only.
I do not have the option to change the file using XMLDocument.
I am looking for a one place solution, not like changing the connection string modifier to public and than change the connection string whenever I use an adapter, This is irrational solution and I refuse to believe that this is the way Microsoft planed the framework.
Is there another way
I develop in C# 2.0
Thank's Itzik katzav

Typed data sets and adapters
TAG
If someone wants the best solution that i have, it is like that:
create a partial class to the adapter:
partial
class vwCandidateSideBarTableAdapter{
public vwCandidateSideBarTableAdapter(bool change_db) : base(){
if (change_db){
this.Connection.ConnectionString = Data_Layer_Settings.Connection_String; //or whenever you store this(registery, etc..)}
}
}
then create the adapter like that
vwCandidateSideBarTableAdapter
adapter = new vwCandidateSideBarTableAdapter(true);monrobot13
I too would like an answer on this, in regards to what the "best practice" is for dynamically changing the connection string for TableAdapters.
I'm uncertain if it matters, but what *I* am doing is creating a DLL that can be used in either a web-app, or windows forms environment, so I need an option that is not tied to the web.config or app.config.
Right now the connection string is being stored in the Project\Properties\settings.settings file.
Any input would be greatly appreciated.
Kevon