[英]Cannot open database "Life" requested by the login. The login failed. Login failed for user
I am getting the following in visual studio:我在视觉工作室得到以下信息:
Cannot open database "Life" requested by the login.
无法打开登录请求的数据库“Life”。 The login failed.
登录失败。 Login failed for user...
用户登录失败...
My sqlconnection string is as follows:我的 sqlconnection 字符串如下:
SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=Life;Integrated Security=True");
What can I do to get this error to be solved.我能做些什么来解决这个错误。
In SQL Server Management Studio under Security-Studio-Properties under user- User mapping I tick db_owner在 SQL Server Management Studio 下 Security-Studio-Properties 下 user-User mapping 我勾选 db_owner
SQL Server agent is running SQL 服务器代理正在运行
The database is on a local PC and not on a network数据库在本地 PC 上,而不是在网络上
There are a number of things that you can check.您可以检查许多事情。 https://docs.microsoft.com/en-us/troubleshoot/sql/connect/resolve-connectivity-errors-overview The most likely problems can be solved by making sure you have the correct database name and user name.
https://docs.microsoft.com/en-us/troubleshoot/sql/connect/resolve-connectivity-errors-overview最可能的问题可以通过确保您拥有正确的数据库名称和用户名来解决。 Your user name will be
MYPCNAME\MyLoginName
in order to use integrated security您的用户名将是
MYPCNAME\MyLoginName
以使用集成安全性
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.