Exemplo n.º 1
0
        public void ConnectDatabase()
        {
            InitializeConfig();
            using (SqlConnection wCnn = new SqlConnection(_CurrentCnnString.ToString()))
            {
                try
                {
                    wCnn.Open();

                    wCnn.Close();
                }
                catch (SqlException e)
                {
                    throw e;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pCnnString"></param>
        /// <returns></returns>
        public static bool TestConnection(CnnString pCnnString)
        {
            using (SqlConnection wCnn = new SqlConnection(pCnnString.ToString()))
            {
                try
                {
                    wCnn.Open();

                    wCnn.Close();
                    return(true);
                }
                catch (Exception ex)
                {
                    throw new DataBaseExeption(ex, pCnnString);
                }
            }
        }