OdbcDBHelper
Inheritance: DBHelperBase
Example #1
0
        public static DBHelperBase CreateDBHelper()
        {
            DBHelperBase dbh;
            if (config != null)
            {
                string conString = config.GetDBConnStr();
                switch (DBType.ToLower())
                {
                    case "odbc":
                        dbh = new OdbcHelper(new OdbcConnection(conString));
                        break;
                    case "sqlserver":
                        dbh = new SqlHelper(new SqlConnection(conString));
                        break;
                    case "sybase":
                        dbh = new SybaseHelper(new AseConnection(conString));
                        break;
                    case "access":
                        dbh = new OleDbHelper(new OleDbConnection(conString));
                        break;
                    case "oledb":
                        dbh = new OleDbHelper(new OleDbConnection(conString));
                        break;
                    default:
                        throw new DBConfigException();

                }
                dbh.Open();
                return dbh;

            }
            else//config is null
                return null;
        }
Example #2
0
        public static DBHelperBase CreateDBHelper()
        {
            DBHelperBase dbh;

            if (config != null)
            {
                string conString = config.GetDBConnStr();
                switch (DBType.ToLower())
                {
                case "odbc":
                    dbh = new OdbcHelper(new OdbcConnection(conString));
                    break;

                case "sqlserver":
                    dbh = new SqlHelper(new SqlConnection(conString));
                    break;

                case "sybase":
                    dbh = new SybaseHelper(new AseConnection(conString));
                    break;

                case "access":
                    dbh = new OleDbHelper(new OleDbConnection(conString));
                    break;

                case "oledb":
                    dbh = new OleDbHelper(new OleDbConnection(conString));
                    break;

                default:
                    throw new DBConfigException();
                }
                dbh.Open();
                return(dbh);
            }
            else//config is null
            {
                return(null);
            }
        }