简体   繁体   English

无法打开登录请求的数据库“Life”。 登录失败。 用户登录失败

[英]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.

相关问题 无法打开登录请求的数据库“ [数据库]”。 登录失败。 用户“ [User]”的登录失败 - Cannot open database “[Database]” requested by the login. The login failed. Login failed for user '[User]" 无法打开登录请求的数据库“身份”。 登录失败。 用户“DESKTOP\User”登录失败 - Cannot open database “Identity” requested by the login. The login failed. Login failed for user 'DESKTOP\User' 无法打开登录请求的数据库“MyBase”。 登录失败。 用户“域\用户”登录失败 - Cannot open database "MyBase" requested by the login. The login failed. Login failed for user 'domain\User' 无法打开登录请求的数据库“ Inventory_New”。 登录失败。 用户“ sa”的登录失败 - Cannot open database “Inventory_New” requested by the login. The login failed. Login failed for user 'sa' 无法打开登录请求的数据库“ ASPState”。 登录失败。 用户“ xxxx”的登录失败 - Cannot open database “ASPState” requested by the login. The login failed. Login failed for user 'xxxx' 无法打开登录请求的数据库“test”。 登录失败。 用户 'Domain\\userid' 登录失败 - Cannot open database "test" requested by the login. The login failed. Login failed for user 'Domain\userid' 无法打开登录请求的数据库“Test”。 登录失败。 用户'sa'登录失败 - Cannot open database “Test” requested by the login. The login failed. Login failed for user 'sa' 无法打开登录请求的数据库“”。 登录失败。 用户“ sa”的登录失败 - Cannot open database “” requested by the login. The login failed. Login failed for user 'sa' 无法打开登录请求的数据库“databaseName”。登录失败。用户登录失败 - Cannot open database “databaseName" requested by the login. The login failed. Login failed for user 无法打开登录请求的数据库“ dbTest”。 登录失败。 用户“ testUser”的登录失败 - Cannot open database 'dbTest' requested by the login. The login failed. Login failed for user 'testUser'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM