Beispiel #1
0
        public virtual bool Connect(enmConnection dbType, DbConnection DbConnection)
        {
            switch (dbType)
            {
            case enmConnection.Access: { db = new Access(DbConnection); break; }

            case enmConnection.Interbase: { db = new Interbase(DbConnection); break; }

            case enmConnection.Firebird: { db = new Firebird(DbConnection); break; }

            case enmConnection.MySql: { db = new MySql(DbConnection); break; }

            case enmConnection.SqlServer: { db = new SqlServer(DbConnection); break; }

            case enmConnection.SqlServerCe: { db = new SqlServerCe(DbConnection); break; }

            case enmConnection.SQLite: { db = new SQLite(DbConnection); break; }

            case enmConnection.Oracle: { db = new OracleODAC(DbConnection); break; }

            case enmConnection.Odbc: { db = new Odbc(DbConnection); break; }

            case enmConnection.OleDb: { db = new OleDb(DbConnection); break; }

            default:
            { break; }
            }

            return(db.IsConnected());
        }
Beispiel #2
0
        /*public bool Connect(String str_dbType, InfoConnection Info)
         * {
         * Array arr = Enum.GetNames(typeof(enmConnection));
         * int idx_dbtype = -1;
         * for (int i = 0; i < arr.Length; i++)
         * {
         * if (str_dbType == arr.GetValue(i).ToString())
         * { idx_dbtype = i; }
         * }
         *
         * this.dbType = ((enmConnection)idx_dbtype);
         * this.Info = Info;
         * return this.cnn.Connect(dbType, Info);
         * }*/
        #endregion

        #region public bool Connect(enmConnection dbType, InfoConnection Info)
        public bool Connect(enmConnection dbType, InfoConnection Info)
        {
            this.ForeignKeys = null;
            this.dbType      = dbType;
            this.Info        = Info;
            return(this.cnn.Connect(dbType, Info));
        }
Beispiel #3
0
        public bool Connect(string ConnectionString)
        {
            string[]       Fields  = ConnectionString.Split(new char[] { ';' });
            Conversion     cnv     = new Conversion();
            enmConnection  _dbType = GetDbType(GetValue("DbType", Fields));
            InfoConnection _info   = new InfoConnection(cnv.ToBool(GetValue("UseWindowsAuthentication", Fields)), GetValue("Server", Fields), GetValue("Database", Fields), GetValue("User", Fields), GetValue("Password", Fields));

            return(Connect(_dbType, _info));
        }
Beispiel #4
0
 public void Reconfigure(enmConnection DbType, InfoConnection InfoConnection)
 {
     this.cfg.DbType = DbType;
     this.cfg.Info   = InfoConnection;
     SaveDbParam();
 }
Beispiel #5
0
 public bool Connect(enmConnection dbType, DbConnection DbConnection)
 {
     this.dbType = dbType;
     return(this.cnn.Connect(dbType, DbConnection));
 }