using BP.Sys; using System; using System.Data.SqlClient; namespace BP.DA { /// /// 连接到哪个库上. /// 他们存放在 web.config 的列表内. /// public enum DBUrlType { /// /// 主应用程序 /// AppCenterDSN } /// /// DBUrl 的摘要说明。 /// public class DBUrl { /// /// 连接 /// public DBUrl() { } /// /// 连接 /// /// 连接type public DBUrl(DBUrlType type) { this.DBUrlType=type; } /// /// 默认值 /// public DBUrlType _DBUrlType=DBUrlType.AppCenterDSN; /// /// 要连接的到的库。 /// public DBUrlType DBUrlType { get { return _DBUrlType; } set { _DBUrlType=value; } } public string DBVarStr { get { switch (this.DBType) { case DBType.Oracle: case DBType.KingBaseR3: case DBType.KingBaseR6: case DBType.PostgreSQL: case DBType.UX: case DBType.HGDB: return ":"; case DBType.MySQL: case DBType.MSSQL: return "@"; case DBType.Informix: return "?"; default: return "@"; } } } /// /// 数据库类型 /// public DBType DBType { get { switch(this.DBUrlType) { case DBUrlType.AppCenterDSN: return DBAccess.AppCenterDBType ; default: throw new Exception("不明确的连接"); } } } } }