关于链接sql server 2005的问题。。急。请高手帮忙

flybirdtt 2009-05-04 02:17:46
利用vs2008建立了 aspx。然后条件gridview.然后选择datasource。测试:
结果是:
Server Error in '/WebSite8' Application.
--------------------------------------------------------------------------------

Cannot open database "Dafesty" requested by the login. The login failed.
Login failed for user 'WWW-4AF57705A7F\ASPNET'.
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.SqlClient.SqlException: Cannot open database "Dafesty" requested by the login. The login failed.
Login failed for user 'WWW-4AF57705A7F\ASPNET'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SqlException (0x80131904): Cannot open database "Dafesty" requested by the login. The login failed.
Login failed for user 'WWW-4AF57705A7F\ASPNET'.]
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.SqlInternalConnectionTds.CompleteLogin(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
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1770
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +50
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041


...全文
131 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
flybirdtt 2009-05-05
  • 打赏
  • 举报
回复
设置好了。应该是用户权限没设置好。
clickAlex 2009-05-04
  • 打赏
  • 举报
回复
数据库配置文件问题 web.config里
wanzegui 2009-05-04
  • 打赏
  • 举报
回复
Cannot open database "Dafesty" requested by the login. The login failed.
Login failed for user 'WWW-4AF57705A7F\ASPNET'.
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.
备注:英文提示,在登录请求(数据库)中,无法打开数据库“Dafesty”,登录失败,失败原因是user 'WWW-4AF57705A7F\ASPNET'.此证明你的用户user 'WWW-4AF57705A7F\ASPNET'.无权限访问数据库,建议你在SQL server 中添加user 'WWW-4AF57705A7F\ASPNET'.的权限,或者默认让ASP.NET内置用户访问。
wuyq11 2009-05-04
  • 打赏
  • 举报
回复
用户权限问题,在安全性里添加数据操作用户或用Integrated Security=false;
flybirdtt 2009-05-04
  • 打赏
  • 举报
回复
行。帮我解决了。就好。谢谢.只是一天后才能加分。
lgaimin 2009-05-04
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 llsen 的回复:]
连接字符串问题
或者 服务器防火墙要关闭
[/Quote]
回帖是一种美德!每天回帖即可获得 10 分可用分!
沉序员 2009-05-04
  • 打赏
  • 举报
回复
多加點分,我幫你解決?
flybirdtt 2009-05-04
  • 打赏
  • 举报
回复
刚才试了从VS2008的asp.net configuration进入。选择security然后也显示连接不上sql server
qq6212639 2009-05-04
  • 打赏
  • 举报
回复
纯英文的 好难看懂 !不过这句话可能你要关注一下 Login failed for user 'WWW-4AF57705A7F\ASPNET'
flybirdtt 2009-05-04
  • 打赏
  • 举报
回复
连接是可以的。 在vs2008建立form然后绑定数据。DATASET什么的都可以。就是web提示login失败
peng_weida 2009-05-04
  • 打赏
  • 举报
回复
看下数据库连接 是否成功
llsen 2009-05-04
  • 打赏
  • 举报
回复
连接字符串问题
或者 服务器防火墙要关闭

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧