How to access localdb associated database created by Visual Studio

Our team have a VS 2013 solution with several database projects created on project build. They are automatically hosted in localdb.

The default target connection looks like this:
"Data Source=(localdb)\Projects;Initial Catalog=ProjectName;Integrated Security=True;Pooling=False;Connect Timeout=30"

These databases are not visible in SSMS so we have been forced to use VS inbuilt data tools to manipulate and investigate data. The functionality there is very limited so I had hoped we could use LINQPad. Today I received my LINQPad activation code but soon found out that the "Details..." link I had hoped would give me some magic new options, was just about adding more databases.

The error message I receive in LINQPad is this:
Cannot open database "C:\Users\myname\AppData\Local\Microsoft\VisualStudio\SSDT\solutionname\projectname_Primary.mdf" requested by the login. The login failed. Login failed for user mydomain\myname.

Can anyone give me some hints on this?
Is there a workaround?
Can anything be done to the connection defined in LINQPad, to the project setup, to the localdb configuration, .... ?

Comments

  • Sorry, but I experimented a lot, so the above error message was actually when I tried to "Specify a new or existing database".

    The option that I assume would be correct was the "Attach database file".
    Then the error message says:
    Operating system error 32: The process cannot access the file because it is being used by another process. An attempt to add an auto-named database for file "C:\Users\myname\AppData\Local\Microsoft\VisualStudio\SSDT\solutionname\projectname_Primary.mdf" failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!