Programmatically changing a Data Source's connection property

R

RB0135

Hi,

I hope I worded the subject correctly.

Under VS2005, I have created the wizard to add a datasource that
connects to my SQL2005 server. I ran through the wizard and this
created a Dataset, a BindingSource and TableAdpater.

I noticed in the file App.Config, it created an entry under MYSETTINGS
for called xxxx.My.MySettings.xxxConnectionString with a connection
string parameter.

So far, this is great and on the development PC (mine) this works
perfectly.

Of course, when it goes into Production I need the server in the
connection string to be dynamic. The reason being is the program is
launched with args and one of the args determines which server to
access to get the data from. Of course, the development PC is NOT one
of those that can get the data.

I have searched but most people seem to talk about changing the
App.Config file (well, the XML file) yet that requires an application
restart.

I know that the App.Config parameter is read only, but is there anyway
to override this and tell the Datasource to use the dynamically
created connection string?

Any help???

Thanks,
Robert
 
M

Mr. Arnold

I know that the App.Config parameter is read only, but is there anyway
to override this and tell the Datasource to use the dynamically
created connection string?

The App.config is a template. The config file the program is using is called
programname.exe.config is where the program is getting its information,
which is derived form App.config and can be edited by any text editor.

So, I can't see why you couldn't change the SQL Server Name to be access in
the programname.exe.config manually based on the environment the application
is running in like local, test, quality assurance, or production SQL server
name based on the information supplied before the applications is deployed
into the particular environment.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top