程序经常运行一段时间就出错,突出显示“Line 61: myconn.Open();”什么原因?myconn.open()后我都有myconn.close()的。Server Error in '/xzf' Application.
--------------------------------------------------------------------------------未指定的错误
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OleDb.OleDbException: 未指定的错误Source Error:
Line 59: mycmd.Parameters.Add("@序号", OleDbType.Char, 5);
Line 60: mycmd.Parameters["@序号"].Value = xuhao;
Line 61: myconn.Open();
Line 62: OleDbDataAdapter adapter = new OleDbDataAdapter(mycmd);
Line 63: DataTable table = new DataTable();
Source File: c:\Inetpub\wwwroot\xzf\danbi.aspx.cs Line: 61 Stack Trace:
[OleDbException (0x80004005): 未指定的错误]
System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +1054817
System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +53
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +27
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +47
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.OleDb.OleDbConnection.Open() +37
danbi.zhongjianyewu(String xuhao) in c:\Inetpub\wwwroot\xzf\danbi.aspx.cs:61
danbi.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\xzf\danbi.aspx.cs:28
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
--------------------------------------------------------------------------------未指定的错误
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OleDb.OleDbException: 未指定的错误Source Error:
Line 59: mycmd.Parameters.Add("@序号", OleDbType.Char, 5);
Line 60: mycmd.Parameters["@序号"].Value = xuhao;
Line 61: myconn.Open();
Line 62: OleDbDataAdapter adapter = new OleDbDataAdapter(mycmd);
Line 63: DataTable table = new DataTable();
Source File: c:\Inetpub\wwwroot\xzf\danbi.aspx.cs Line: 61 Stack Trace:
[OleDbException (0x80004005): 未指定的错误]
System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +1054817
System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +53
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +27
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +47
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.OleDb.OleDbConnection.Open() +37
danbi.zhongjianyewu(String xuhao) in c:\Inetpub\wwwroot\xzf\danbi.aspx.cs:61
danbi.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\xzf\danbi.aspx.cs:28
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
{
conn1.Close();
}if (conn1.State.ToString() == "Closed")
{
conn1.Open();
}
1、服务器上存放 Access 数据库的文件夹的权限是否给了? Everyone用户或Internet来宾用户,并赋予其修改权限
2、服务器上的临时文件太多了,要重新启动一下服务器,或者要清理临时文件或者调整磁盘空间了
if (conn1.State.ToString() == "Closed")
{
conn1.Open();
}
my blog
http://ufo-crackerx.blog.163.com/