1

Currently I was going through Microsoft's ASP.NET Core MVC tutorial and it came to a point where I created a database context class, coming complete with a connection string that I add during the config.

Problem is however, when I check with SQL Server Management Studio, I cannot find the database created; I've logged on to both my local host as well as my PC name (for Windows auth) but the database created doesn't exist on either servers.

MS stated in their docs that when I run the command Update-Database in the PMC it would create it but I cant find it anywhere. I've tried using the name of the server from the connection string (localdb) but I cannot connect because SSMS doesn't recognize the instance.

Any idea why it doesn't show up on the studio but seems to work fine during the application running?

Connection string as follows:

"MvcMovieContext": "Server=(localdb)\\mssqllocaldb;Database=MvcMovieContext-1;Trusted_Connection=True;MultipleActiveResultSets=true"
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

0

About the LocalDB location, please, take a look here:

https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-express-localdb?view=sql-server-ver15#:~:text=User%20database%20files%20are%20stored,add%20tables%20in%20Visual%20Studio.

Your LocalDB should be located on C:\Users\<user>\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\mssqllocaldb, assuming mssqllocaldb is your instance name, based on the connection strig you have provided.

Also, to connect to your LocalDB, follow the answers given on this post, I guess could be helpful on your case:

How to connect to LocalDB in Visual Studio Server Explorer?

Dale K
  • 25,246
  • 15
  • 42
  • 71
Dave Miller
  • 536
  • 3
  • 19