"Brad Pears" <br***@truenorthloghomes.comwrote in message
news:ew**************@TK2MSFTNGP04.phx.gbl...
We have several applications that use the ".exe.config" .xml file to get
the connection string to our SQL server db. Each user of the application
has their own .xml file because we have some user specific settings in
there...
My question is this... We are looking at setting up a backup SQL server.
I would like to modify the .xml config files so that they read the
connection string from a network share instead. That way, we can easily
change the server name in place so that the next time the users run the
app, it will be pointing to the backup server and vice versa.
Does anyone have any ideas how this could be done?
You come-up with a file called connstr.txt and have the connection string in
that file, after all it's just string/text data in a file, whether it's in
an XML file or a non XML text file type.
You create a function that opens that file and reads the string data from
connstr.txt. You can have a path statement in the ".exe.config" .xml
pointing to connstr.txt. Connstr.txt can be out there on a network share.
You're only problem would be if two or more users tried to open Connstr.txt
at the same time.
You may need some code in the function to try again to open the file on some
iteration count, before it indicates it can't open the file. But that's most
likely not going to happen anyway with multiple users trying to open the
file at the same time.