错误提示页面:
'/' 应用程序中发生服务器错误。
--------------------------------------------------------------------------------
无法指出的错误
描述: 在执行目前 Web 要求的过程中发生未处理的例外情形。请检阅堆栈追踪以取得错误的详细信息,以及在程序代码中产生的位置。
例外详细信息: System.Data.OleDb.OleDbException: 无法指出的错误
原始程序错误:
在执行目前 Web 要求期间,产生未处理的例外状况。如需有关例外状况来源与位置的信息,可以使用下列的例外状况堆栈追踪取得。
堆栈追踪:
[OleDbException (0x80004005): 无法指出的错误]
System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +969373
System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +86
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +29
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +4863644
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
System.Data.OleDb.OleDbConnection.Open() +40
AccessHelper.PrepareCommand(OleDbCommand cmd, OleDbConnection conn, OleDbTransaction trans, String cmdText, OleDbParameter[] cmdParms) +38
AccessHelper.ExecuteReader(String connectionString, String cmdText, OleDbParameter[] commandParameters) +138
home.Page_Load(Object sender, EventArgs e) +65
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
数据库操作类:AccessHelper.cs
用了AspNetPager分页控件,代码如下:
string sql = "select * from news order by newtime desc";
string con = AccessHelper.conn;
AspNetPager1.RecordCount = AccessHelper.ExecuteDataSet(con, sql).Tables[0].Rows.Count;
OleDbConnection conn = new OleDbConnection(con);
OleDbDataAdapter Ad = new OleDbDataAdapter(sql, conn);
DataSet Ds = new DataSet();
Ad.Fill(Ds, AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, "tb");
DataList1.DataSource = Ds.Tables["tb"];
DataList1.DataBind();
conn.Dispose();
conn.Close();
哪位大虾帮忙看下这段代码有什么问题,比如如果连接过多的话会不会导致程序挂掉.早上上传到服务器,刚才突然出错,提示执行过程错误,重新上传了web.config覆盖了,就可以了,但却没找到具体出错原因.之前没有用分页控件,数据操作都是直接用accesshelper的,并没有出问题,这次修改用了分页控件才加了上面这个代码,所以才考虑可能是这段代码出问题,因为比较菜,对数据连接操作并不怎么了解具体执行过程,所以请懂的朋友帮忙看下.