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; }
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); } }