不能使用 '';文件已在使用中。
行 20: //public static string ConnString ="Provider = Microsoft.Jet.OLEDB.4.0;Data Source = "+ HttpContext.Current.Server.MapPath( System.Configuration.ConfigurationSettings.AppSettings["ConnString"] );
行 21: public XOleDb objXSqlClient = new XOleDb(ConnString);
行 22:
---------------------
好像是在这一句中建立了连接,但没能关闭
看代码:
namespace book_shop.Lib
{
/// <summary>
/// System.Web.UI.Page控件的基类。
/// </summary>
public class PageBase : System.Web.UI.Page
{
private static string ConnString ="Provider = Microsoft.Jet.OLEDB.4.0;Data Source = "+ @"E:\Website\book_shop\DataBase\BookShop.mdb";
public XOleDb objXSqlClient = new XOleDb(ConnString);
/// <summary>
/// 构造函数。
/// </summary>
public PageBase()
{
this.Unload += new EventHandler(PageBase_Unload);
}
/// <summary>
/// 页面被关闭时断开与数据库的连接。
/// </summary>
private void PageBase_Unload(object sender, System.EventArgs e)//
{
objXSqlClient.DBClose();
objXSqlClient = null;
}
}