Login failed for user a\\b

2019-08-10 02:30发布

问题:

I created a SQL connection as below:

SqlConnection scSqlConnection = new SqlConnection("Server= " + ".\\" + strInstanceName + ";Initial Catalog=" + "master" + ";Integrated Security=True;");

and when I try to open this connection in my application there's no problem so I expect to be able to connect via SSMS in windowsAuthentication mode, but when I try to connect via SQL server management with Server name = .\strInstanceName in windowsAuthentication mode, I get the following error :

login failed for user a\b

Would you, please, help me ?