【发布时间】:2017-03-29 00:53:49
【问题描述】:
我能够在 Windows 身份验证和 SQL Server 身份验证下登录 SSMS。但我在 SQL Server Management Studio 的任何地方都没有看到数据库。在 Visual Studio 中,即使我已更改连接字符串以在我的 SSMS 中创建数据库,它也会转到 localDb。
<!--<add name="BookServiceContext" connectionString="Data Source=(localdb)\MSSQLLocalDB; Initial Catalog=BookServiceContext-20170328200803; Integrated Security=True; MultipleActiveResultSets=True; AttachDbFilename=|DataDirectory|BookServiceContext-20170328200803.mdf"
providerName="System.Data.SqlClient" />-->
<add name="BookServiceContext" connectionString="Data Source=AA5570LT;Initial Catalog=BookServiceContext;Integrated Security=SSPI;" providerName="System.Data.SqlClient" />
有时,我可以在 VS 服务器资源管理器的数据连接下看到名称 BookServiceContext,但是当我单击连接时,我会收到此错误消息
无法打开登录请求的数据库“BookServiceContext”。登录失败。 用户“MLS\AAnwar”登录失败。
我该怎么做才能让它在我的 SSMS 中正确连接?
【问题讨论】:
-
用户
MLS\AAnwar可能没有所需的权限,因为Integrated Security=SSPI已被使用,表明 Windows 身份验证模式已启用。在 SQL Server 中检查您的 Windows 帐户登录权限,或使用在连接字符串中提供User ID和Password参数的混合模式身份验证。 -
我该怎么做?我在 VS 中的同一解决方案中的另一个项目使用相同的连接字符串可以正常工作。我不知道为什么这不起作用?
标签: sql-server asp.net-mvc visual-studio ssms