0

I'm trying to set up a new project in ASP.Net Core using an existing database.

When I run the following console command, however, I get a login failed error.

Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=TeamAllyLibrary;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

I get the following error each time.

Cannot open database "TeamAllyLibrary" requested by the login. The login failed.
  • You are using trusted connection and your account is not permitted to access the database or the server / database doesn't exist at all. Use the sa user. – alsami Aug 20 '18 at 18:53

1 Answers1

0

I found the issue. Using Server=(localdb)\mssqllocaldb was connecting to the wrong SQL server instance. (Not sure what instance it was using) So the database I was trying to connect to was not being found.