Exemple #1
0
        private static void InitDB()
        {
            if (_DB == null)
            {
                _DB = new Dictionary <String, SqlBase>();
            }
            if (_DB.Count > 0)
            {
                return;
            }
            foreach (ConnectionStringSettings css in MyDbSetting.GetAllConnections())
            {
                SqlBase sb = null;
                switch (MyDbSetting.GetProviderType(css.ProviderName))
                {
                case ProviderType.MsSql: sb = new MsSql(MyDbSetting, css.Name); break;

                case ProviderType.OleDb: sb = new OleDb(MyDbSetting, css.Name); break;

                case ProviderType.Odbc: sb = new Odbc(MyDbSetting, css.Name); break;

                case ProviderType.Oracle: sb = new Oracle(MyDbSetting, css.Name); break;

                case ProviderType.MySql: sb = new MySql(MyDbSetting, css.Name); break;
                }
                sb.DSS = MyDss;
                if (sb != null)
                {
                    if (!_DB.ContainsKey(css.Name))
                    {
                        _DB.Add(css.Name, sb);
                    }
                }
            }
        }
Exemple #2
0
        public static SqlBase NewDB(ProviderType providerType, String connectionString)
        {
            SqlBase sb = null;

            switch (providerType)
            {
            case ProviderType.MsSql: sb = new MsSql(connectionString); break;

            case ProviderType.OleDb: sb = new OleDb(connectionString); break;

            case ProviderType.Odbc: sb = new Odbc(connectionString); break;

            case ProviderType.Oracle: sb = new Oracle(connectionString); break;

            case ProviderType.MySql: sb = new MySql(connectionString); break;
            }
            sb.DSS = MyDss;
            return(sb);
        }