SqlException未处理:用户'sa'登录失败:

Dus*_*usk 2 .net c# sqlexception sql-server-2008

我正在尝试在visual studio 2010中远程连接到sql server 2008 express,但我得到一个例外: SqlException was unhandled: Login failed for user 'sa'尽管输入了正确的用户名和密码.

以下是app.cofigWindows窗体中的文件示例,它试图连接到sql server express:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
 </configSections>
 <connectionStrings>
  <add name="Prod" connectionString="Network Library=DBMSSOCN;Data Source= 192.100.100.199\SQLEXPRESS;Initial Catalog = inventory;User Id=sa;Password = Pass;MultipleActiveResultSets = True"
   providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
Run Code Online (Sandbox Code Playgroud)

谁能告诉我怎样才能解决这个问题?

dkl*_*dkl 6

安装SQL Server时,默认情况下不启用"混合身份验证".在SQL Server Management Studio Express中进行检查 - 右键单击​​服务器节点,打开属性,转到安全性,启用"SQL Server和Windows身份验证模式".