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;
}
源错误:
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;
}
...全文
相关推荐
System.Data.OleDb.OleDbException: 未指定的错误的完美解决方法
本文给大家带来三种有关System.Data.OleDb.OleDbException: 未指定的错误的完美解决方法,每种方法都很不错,需要的朋友可以参考下
Access数据库提示OleDbException (0x80004005): 操作必须使用一个可更新的查询
使用Access当数据库时,这个问题郁闷了我好几天啊![OleDbException (0x80004005): 操作必须使用一个可更新的查询。]
C#连接Access数据库的实例教程
C#连接Access数据库的实例教程 可以快速的连接数据库 看后让你顿时 茅塞顿开、、
System.Runtime.InteropServices.COMException的解决方法
完美解决“换另一台电脑上用VS2008继续开发web项目时出现 “System.Runtime.InteropServices.COMException”,然后是加载不了项目。” 只需要打开项目配置文件*.csproj,将True 改为 False,然后可以正常加载项目,接着重新配置为正常的IIS. 您可能感兴趣的文章:System.Data.SqlClient.SqlException: 无法打开登录所请求的数据库 登录失败。System.Data.SQLite 数据库详细介绍SQL Server出现Syst
在Visual C#中访问不同数据库
在Visual C#中访问不同数据库


