麻烦大家帮我看看,我在WEB.CONFIG文件里写了如下代码:
<appSettings>
<add key="connstring" value="Provider = Microsoft.Jet.OLEDB.4.0;Data Source=c:\\Inetpub\\wwwroot\\moto\\db1.mdb"/> <!--<add key="SQLConn" value="Password=s2n9d4t3;Persist Security Info=True;User ID=cw0d064;Initial Catalog=cw0d064_db;Data Source=(local)"/>-->
</appSettings>
在程序文件下写入:
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!Page.IsPostBack)
{
string strConn=ConfigurationSettings.AppSettings["connstring"];
OleDbConnection myconn=new OleDbConnection(strConn);
OleDbDataAdapter mycmd=new OleDbDataAdapter("select * from product",myconn);
DataSet ds=new DataSet();
mycmd.Fill(ds,"product");
DataList1.DataSource=ds.Tables["product"].DefaultView;
DataList1.DataBind(); }
可是当我执行时,系统会提示如下错误:
“/moto”应用程序中的服务器错误。
--------------------------------------------------------------------------------不能使用 '';文件已在使用中。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.OleDb.OleDbException: 不能使用 '';文件已在使用中。源错误:
行 30: OleDbDataAdapter mycmd=new OleDbDataAdapter("select * from product",myconn);
行 31: DataSet ds=new DataSet();
行 32: mycmd.Fill(ds,"product");
行 33: DataList1.DataSource=ds.Tables["product"].DefaultView;
行 34: DataList1.DataBind();
源文件: c:\inetpub\wwwroot\moto\page\index11.aspx.cs 行: 32
<appSettings>
<add key="connstring" value="Provider = Microsoft.Jet.OLEDB.4.0;Data Source=c:\\Inetpub\\wwwroot\\moto\\db1.mdb"/> <!--<add key="SQLConn" value="Password=s2n9d4t3;Persist Security Info=True;User ID=cw0d064;Initial Catalog=cw0d064_db;Data Source=(local)"/>-->
</appSettings>
在程序文件下写入:
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!Page.IsPostBack)
{
string strConn=ConfigurationSettings.AppSettings["connstring"];
OleDbConnection myconn=new OleDbConnection(strConn);
OleDbDataAdapter mycmd=new OleDbDataAdapter("select * from product",myconn);
DataSet ds=new DataSet();
mycmd.Fill(ds,"product");
DataList1.DataSource=ds.Tables["product"].DefaultView;
DataList1.DataBind(); }
可是当我执行时,系统会提示如下错误:
“/moto”应用程序中的服务器错误。
--------------------------------------------------------------------------------不能使用 '';文件已在使用中。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.OleDb.OleDbException: 不能使用 '';文件已在使用中。源错误:
行 30: OleDbDataAdapter mycmd=new OleDbDataAdapter("select * from product",myconn);
行 31: DataSet ds=new DataSet();
行 32: mycmd.Fill(ds,"product");
行 33: DataList1.DataSource=ds.Tables["product"].DefaultView;
行 34: DataList1.DataBind();
源文件: c:\inetpub\wwwroot\moto\page\index11.aspx.cs 行: 32
你可以关掉VS,试试看