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
Post a Comment