System.Data.OleDb.OleDbException: 未指定的错误 !
网上找了很多文章来看。。好像都不行。。
源错误:
try
行 62: {
行 63: conn.Open();
行 64: dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
行 65: }
推跟中:
[OleDbException (0x80004005): 未指定的错误]
System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +1054657
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
ProductSort.GetProductSortAll() in d:\kaoshiung\App_Code\ProductSort.cs:63
[Exception: 未指定的错误]
ProductSort.GetProductSortAll() in d:\kaoshiung\App_Code\ProductSort.cs:68
productsort1.BindProductSortData() in d:\kaoshiung\productsort1.aspx.cs:60
productsort1.Page_Load(Object sender, EventArgs e) in d:\kaoshiung\productsort1.aspx.cs:30
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
cs代码就这样
public OleDbDataReader GetProductSortByID(int nSortID)
{
OleDbConnection conn = db.CreateConnection();
string cmdText = "select * from productSort where sortID=" + nSortID;
OleDbCommand myCommand = new OleDbCommand(cmdText, conn);
OleDbDataReader dr = null;
try
{
conn.Open();
dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
}
catch (OleDbException ex)
{
throw new Exception(ex.Message, ex);
}
return dr;
}