you connect to server: (localdb)\mssqllocaldb
then you will need to attach the database if it is not attached.
note: you will need the full file path to the .mdf
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Problem Description
brand new Core 6 project with simple database with two records (property sets) added to it using SQLExpress.
MSSMS unable to open .mdf file throwing errors (error log below).
Steps Taken So Far:
Verified full access to .mdf file to user accounts on computer.
Error:
TITLE: Microsoft SQL Server Management Studio
------------------------------
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
For help, click: https://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
CREATE FILE encountered operating system error 2(The system cannot find the file specified.) while attempting to open or create the physical file 'C:\Users\User1\WebApplicationProjectLevel.Data'. (Microsoft SQL Server, Error: 5123)
For help, click: https://learn.microsoft.com/sql/relational-databases/errors-events/mssqlserver-5123-database-engine-error
------------------------------
BUTTONS:
OK
------------------------------
you connect to server: (localdb)\mssqllocaldb
then you will need to attach the database if it is not attached.
note: you will need the full file path to the .mdf
Use the same connection string with studio as in the .net 6 project. It should be able to connect to sql express the same way.
Note: SSMS can not open a mdf directly, it needs a sql service instance to attach and expose it. The connect string gives the instance the info to attach.
Problem resolved.