c# - SQL change static connection string if there is no connection -


i have static class, return connection string like:

public static string cstring() {      //(...)      string connstring = string.empty;     //check if have read connstring file or use static connstring     if(readconnstringfromfile)         connstring = "...";     else         connstring = "...";      return connstring; } 

so anywhere in application im creating new connection server like:

using(sqlconnection conn = new sqlconnection (cstring.connstring)) 

i have 2 databases. if application lose connection main db, i'd change connectionstring second one. possible (for example in app.xaml.cs) check connection database , if doesnt response change it? if possible, how overload application? need best method, wont overload much, becouse pc's quiet weak.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -