I'm trying to connect to my single SQL Server Express instance using Windows authentication after following this particular tutorial (Tutorial)
Here is the connection string:
<connectionStrings>
<add name="EmployeeContext"
connectionString="Server=.\SQLEXPRESSDAZ; database=Employee; Integrated Security = SSPI"
providerName="System.Data.SqlClient"/>
</connectionStrings>
I've been in SSMS and made sure my user mappings are set to db_owner
and that the Employee
table is the default table for the user: domain\name
.
However, after many combinations of key/value pairs I tried after seeing many examples, I get the error:
The system cannot find the file specified
SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server.....
I've even tried creating new users with user mappings to the Employee DB and changing Integrated Security = SSPI
to a user id
and password
, and still I cannot connect to this instance locally.
Here is a screen grab of SSMS:
UPDATE
I've changed the server attribute to: Server=localhost\SQLEXPRESS
and added: Initial Catalog=dbo
and I have this error now:
Cannot open database "Employee" requested by the login. The login failed.
Login failed for user 'xxxxx\DESKTOP-AIE9SAE$'.
In terms of my code (which can been seen in the Tutorial link), it seems to always be referencing this line 15
if it helps:
Employee employee = employeeContext.Employees.Single(emp => emp.EmployeeId == id);
UPDATE 2
SSMS Security Logins and Users