0

I'm trying to use SQL Server LocalDb to store the database by connection string. During first connection to the database I have an error about connecting to the database. In SSMS it is opening. To fix it I need to add AttachDbFilename with full path to the .mdf file in connection string, despite that I already have Initial Catalog property. After first connection I can remove AttachDbFilename and then connecting will work also perfectly fine. Reproduces only on the Windows Server OS. On Windows 10 everything works fine. What can be the fix of this issue without adding AttachDbFilename during first connection?

3
  • AttachDBFilename is related to using SQLExpress. See if this discussion helps --social.msdn.microsoft.com/Forums/sqlserver/en-US/…
    – Doug Deden
    Commented Dec 9, 2022 at 22:59
  • @DougDeden Also, when I use SQL Express, on Windows Server OS, I can omit AttachDBFilename property, as it is working perfectly fine Commented Dec 9, 2022 at 23:07
  • Your question says it works on Windows 10, but fails on server versions of the operating system. You comment says it works on the server versions. If you could clarify this by editing the question, you might get more answers.
    – Doug Deden
    Commented Dec 12, 2022 at 19:43

0