Пример #1
0
        private static DbConnection MainConn; //= new SqlConnection(ConfigurationManager.ConnectionStrings["SQLDirectDB"].ConnectionString);

        #region 连接

        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="dbtype">数据库类型</param>
        /// <param name="datasource">数据源</param>
        /// <param name="database">数据库</param>
        /// <param name="userid">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        public static bool Initial(string datasource, string database, string userid, string password)
        {
            string connnString = DBFactory.BuildConnStr(datasource, database, userid, password);

            return(Initial(connnString));
        }