|
#region 数据库字符串 //取出Access链接字符串 protected static readonly string AccessLinkStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="; protected static readonly string DB = "DADB.mdb";
server Server; int rootlen; public AccessFactory(server SERVER,int ROOTLEN) { Server = SERVER; rootlen = ROOTLEN; }
//拼凑路径 public string RootStr(int root) { string str = string.Empty; switch (root) { case 0: str = "../BackAdmin/App_Data/"; break; case 1: str = "App_Data/"; break; case 2: str = "../App_Data/"; break; } return @Server.MapPath(str + DB); } //最终链接字符串 public string LinkStr() { return AccessLinkStr + RootStr(rootlen); } #endregion
|