Franken_.App_Code.DataPipe.CheckConnection C# (CSharp) Method

CheckConnection() public method

public CheckConnection ( ) : string
return string
        public string CheckConnection()
        {
            string Results = "";
            bool ConnGood = false;
            bool DBExists = false;

            Conn.ConnectionString = ConnStringSansDB;
            try
            {
                Conn.Open();
                if (Conn.State == ConnectionState.Open)
                {
                    ConnGood = true;
                }
                Conn.Close();
            }
            catch (Exception E)
            {
                Results = "Unable to connect to the database server.  Please verify connection settings in Menu->Settings.  Error Message: " + E.Message;
            }
            Conn.ConnectionString = ConnString;

            if (Results == "" && ConnGood)
            {
                try
                {
                    Conn.Open();
                    if (Conn.State == ConnectionState.Open)
                    {
                        DBExists = true;
                    }
                    Conn.Close();
                }
                catch (Exception E)
                {
                    Results = "Connected to the database server, but you probably need to reset the database by going to Menu->Settings->Reset Database.  Error message: " + E.Message;
                }
            }

            if (ConnGood && DBExists)
            {
                Results = "Connection successful, and database found!";
            }

            return Results;
        }