| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2180 人关注过本帖
标题:无法打开登录所请求的数据库 "chengchen.mdf"。登录失败。
取消只看楼主 加入收藏
xd03071149
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-1-22
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
无法打开登录所请求的数据库 "chengchen.mdf"。登录失败。
无法打开登录所请求的数据库 "chengchen.mdf"。登录失败。
用户 'WWW-578B04BE7B4\Administrator' 登录失败。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.Data.SqlClient.SqlException: 无法打开登录所请求的数据库 "chengchen.mdf"。登录失败。
用户 'WWW-578B04BE7B4\Administrator' 登录失败。

源错误:


行 17: String strSQL="SELECT worker.姓名 FROM worker;";
行 18: SqlCommand objCommand=new SqlCommand(strSQL,objConnection);
行 19: objConnection.Open();
行 20: dgNameList.DataSource=objCommand.ExecuteReader();
行 21: dgNameList.DataBind();
 

源文件: c:\HELLO WORLD\webroot\chapter3\sqlsever_connection.aspx    行: 19

堆栈跟踪:


[SqlException (0x80131904): 无法打开登录所请求的数据库 "chengchen.mdf"。登录失败。
用户 'WWW-578B04BE7B4\Administrator' 登录失败。]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800131
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1932
   System.Data.SqlClient.(Boolean enlistOK) +33
   System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +172
   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +381
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +181
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +173
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +357
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +30
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +494
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
   System.Data.SqlClient.SqlConnection.Open() +111
   ASP.chapter3_sqlsever_connection_aspx.Page_Load(Object sender, EventArgs e) in c:\HELLO WORLD\webroot\chapter3\sqlsever_connection.aspx:19
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436

 


--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.1433; 版本:2.0.50727.1433
我是菜鸟,请大虾帮帮忙
搜索更多相关主题的帖子: mdf 失败 数据库 chengchen 
2010-01-22 10:36
xd03071149
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-1-22
收藏
得分:0 
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
这是web.config文件
2010-01-22 10:38
xd03071149
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-1-22
收藏
得分:0 
<%@ Import Namespace ="System.Data" %>
<%@ Import Namespace ="System.Data.SqlClient" %>
<html>
<head>
<title>Chapter3</title>
</head>
<body>
<h4>First Example:Listing data from the Employees table</h4>
<asp:DataGrid ID ="dgNameList" runat ="server" GridLines ="None" BackColor ="LightBlue" CellPadding ="5" BorderWidth ="2" BorderColor ="Black" ToolTip ="Includes only those employees who are at HQ" />
</body>
</html>
<script language ="C#" runat="server" >
private void Page_Load(object sender,System.EventArgs e)
{
String strConnection="server=WWW-578B04BE7B4\\SQLEXPRESS;database=chengchen;integrated security=true;";
SqlConnection objConnection=new SqlConnection(strConnection);
String strSQL="SELECT * FROM worker";
SqlCommand objCommand=new SqlCommand(strSQL,objConnection);
objConnection.Open();
dgNameList.DataSource=objCommand.ExecuteReader();
dgNameList.DataBind();
objConnection.Close();
}
</script>
这是aspx文件!
2010-01-22 10:39
快速回复:无法打开登录所请求的数据库 "chengchen.mdf"。登录失败。
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.029045 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved