public static bool IsConnected() { if (credentials.UserId == String.Empty) { return(false); } using (SqlConnection con = new SqlConnection(connString, credentials)) { try { con.Open(); return(DBActions.IsConnected(con)); } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } finally { con.Close(); } } }