首先,我尝试使用 Windows 身份验证通过 ssms 连接到其他计算机(PC1-PC\Instance1)的 sql 服务器,但出现此错误
Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.
我1234
在 PC1-PC\Instance1 中编辑 sa 的密码时解决了该错误。然后使用 SQL Server 身份验证在 ssms 中连接。并成功连接。
问题出在我的 Winforms 应用程序配置中,我将连接设置为:
<connectionStrings>
<add name="LibrarySystem.Properties.Settings.LibraryConnectionString" connectionString="Data Source=PC1-PC\Instance1;
Initial Catalog=System1;Integrated Security=True;MultipleActiveResultSets=True;User id = sa;Password = 1234" providerName="System.Data.SqlClient"/>
但我得到了这个错误Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.