using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;

namespace yinLouSys.code
{
    class DataBaseTest
    {
        /// <summary>
        /// 测试是否能连接数据库
        /// </summary>
        /// <param name="conS">连接字符串</param>
        /// <returns></returns>
        public static bool IsConnectionDB(string conS1)
        {
            SqlConnection con = null;
            try
            {
                con = new SqlConnection(conS1);
                con.Open();
                return true;
            }
            catch
            {
                return false;
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                    con = null;
                }
            }
        }
    }
}
