Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi.. friends I'm making a project in vb.net, is that possible in vb.net that if my server name has been changed the connection string should be changed automatically, if yes then please tell how it can be possible

Thanks in advance

Parveen Rathi
Posted
Updated 19-Sep-11 23:58pm
v2

There is no tool to automate this. You can modify the ConnectionString in Web.Config programmatically.
Check the below link.

http://stackoverflow.com/questions/2260317/change-a-web-config-programmatically-with-c-net[^]
 
Share this answer
 
Usually you would use a name instead of IP addresses for your connection string, in the event of failovers etc. it is best to create a DNS alias and change that to a backup server.

This way your server name is always the same.
 
Share this answer
 
Comments
SIFNOk 20-Sep-11 19:06pm    
Agreeed with Mehdi....this should be changed using DNS Alias and should not be hardcoded into your project...and also uses of connectionstring in a configfile would solve the issue if the DNS name changed on the server.
How your application knows directly, that Server name has changed ?

This is customized activity. you need to write a code/EXE which should triggered by user after server name has change.
 
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