连接数据库

来源:互联网 发布:毕向东的java视频教程 编辑:程序博客网 时间:2024/06/07 12:12

        public clsDataBaseLayer(string strConnect, string dataType)
        {
            if (dataType.ToUpper() == "ORACLE")
            {
                this.ConnectionString = Get_ConnectionString(strConnect);
            }
            else
            {
                this.ConnectionString = strConnect;
            }
            this.DbType = dataType;
        }









        public clsDataBaseLayer()
        {
            try
            {
                this.dbType = ConfigurationSettings.AppSettings["DataType"];
                if (this.dbType.ToUpper() == "ORACLE")
                {
                    this.connectionString = Get_ConnectionString(ConfigurationSettings.AppSettings["ConnectionString"]);
                }
                else
                {
                    this.connectionString = ConfigurationSettings.AppSettings["ConnectionString"];
                }
            }
            catch (System.Exception ex)
            {
                throw new Exception(ex.Message);
            }           
        }