?? dbconnection.cs
字號(hào):
using System;
using System.Web;
using System.Web.Caching;
using System.Data.OleDb;
namespace _211
{
/// <summary>
/// DBConnection 的摘要說(shuō)明。
/// </summary>
public class DBConnection
{
public DBConnection()
{
//
// TODO: 在此處添加構(gòu)造函數(shù)邏輯
//
}
//5 1 a s p x.com
public static string getConnStr()
{
if(HttpContext.Current.Cache["conn"]==null)
{
HttpContext.Current.Cache.Insert("conn", "data source="+HttpContext.Current.Server.MapPath("DB_51aspx/db.asax").ToString()+";provider=microsoft.jet.oledb.4.0");
}
return HttpContext.Current.Cache["conn"].ToString();
}
public static OleDbConnection getConn()
{
return new OleDbConnection(getConnStr());
}
public static OleDbConnection getConn(string ConnStr)
{
return new OleDbConnection(ConnStr);
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -