System.Data.OleDb.OleDbException: 未指定的错误 !

mr1son mr1son 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
网上找了很多文章来看。。好像都不行。。
源错误:
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;
}


...全文

相关推荐

评论 13
收藏 已收藏
分享
返回顶部
mr1son
.NET社区 62,274 成员 668,968 内容