.net 网站时常出现这个问题 高手们帮帮忙吧!!怎么解决啊!

来源:百度知道 编辑:UC知道 时间:2024/06/02 01:27:30
Server Error in '/' 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 40: DataSet ds;
Line 41: OleDbConnection odbc = Conn();
Line 42: odbc.Open();
Line 43: OleDbDataAdapter oda = new OleDbDataAdapter(sql, odbc);
Line 44: ds = new DataSet();

Source File: e:\xh\App_Code\dataOperate.cs Line: 42

Stack Trace:

[OleDbException (0x80004005): 未指定的错误]
System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +1054785
System.Data.OleDb.Ole

检查数据库打开后是否关闭,
如odbc.Open()后记得 odbc.close();
if (odbc.State == ConnectionState.Closed)
{
odbc.Open();
}
OleDbDataReader 、 OleDbDataAdapter 等打开之后也要关闭。

检查数据库文件权限

连接数据库的配置文件...

数据库连接的参数有错吧 你看看你的数据库连接字符串 你要是换服务器了应该把数据库地址也改了的