Exemple #1
0
        public static EmDbType MainDbType = EmDbType.None; //主 数据库类型

        #endregion

        #region 0.1 主数据初始化

        /// <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 InitialMainConn(EmDbType dbType, string datasource, string database, string userid, string password)
        {
            string connnString = DBFactory.BuildConnStr(dbType, datasource, database, userid, password);

            MainConnectionString = connnString;
            MainDbType           = dbType;
            MainConn             = DBFactory.NewConnection(dbType, connnString);

            return(InitialMainConn(dbType, connnString));
        }
Exemple #2
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));
        }