Hi Ventsislav,
The connectionString which generated by designer can't be changed at runtime due to it uses the application scope. This kind of questions have been raised many times. You can take a look at the following discussions.
http://social.msdn.microsoft.com/forums/en-US/winforms/thread/1ce2d4a6-3afc-4dbc-aaf3-563035b627d5/ http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/7483b816-be7a-4204-a4d3-cfb14b2aae26 Based on my experience, I think you can choose to edit the app.config file by using notepad, or XML APIs to write the setting to the config file at runtime which you can find sample code from this
thread .
>Also, I have a string variable inside my code that keeps the currently used connection string. The question thus becomes how do I force the data set to use that connection >string?
You can change the ConnectionString of the Connection property of the TableAdapter object before you use the TableAdapter object to fill the dataset.
this.testTableAdapter.Connection.ConnectionString = "current connection string";
this.testTableAdapter.Fill(this.testDataSet.Food);
If you have anything unclear, please feel free to let me know.
Best regards,
Bruce Zhou
Please mark the replies as answers if they help and unmark if they don't.