Search code examples
c#ssms

Getting error while trying to connect to (LocalDB)\MSSQLLocalDB in SQL Server


I've created a winforms app in Visual Studio 2022 and for it to work I've copied the .mdf file of my database (receipts) and pasted in the directory of the project, but when I'm trying to connect to SSMS using (LocalDB)\MSSQLLocalDB I'm getting this error:

Cannot connect to (LocalDB)\MSSQLLocalDB.

Additional information:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.

When I connect using (local) it connects.

I've tried to uninstall SSMS and updated Visual Studio 2022, but it has not helped.


Solution

  • I already had a similar name instance with small letters so I deleted it and made (LocalDB)\MSSQLLocalDB this one and it is working now!