public static ConnectionUp CheckOdbcConnection() { ConnectionUp up = new ConnectionUp(); //Dictionary<bool, string> status = new Dictionary<bool, string>(); AttacheODBCconnection AttacheOdbc = new AttacheODBCconnection(); using (OdbcConnection myConnection = new OdbcConnection()) { myConnection.ConnectionString = AttacheOdbc.ConnectionString; try { myConnection.Open(); myConnection.Close(); up.status = true; // status.Add(true, "Connection Up"); return(up); } catch (Exception ex) { up.status = false; up.exMessage = ex.Message;//status.Add(false, ex.Message); return(up); } } }
public static ConnectionUp CheckSqlLiteConnection() { ConnectionUp up = new ConnectionUp(); try { using (var db = new ZudelloContext()) { db.Database.CanConnect(); up.status = true; // status.Add(true, "Connection Up"); return(up); } } catch (Exception ex) { up.status = false; up.exMessage = ex.Message; return(up); } }