I have a windows form application (developed in VS Express 2013) that connects through an instance of SQL Server 2012 to a database. Both the application and database are on my local system; I just needed a GUI to more easily interface with this very large database that stores my research data. When I initially compile and deploy the application, it works fine and has no connection problems with the database. However, if I then attach the database in SQL Server Management Studio (which I sometimes wnat to do) I get an error the next time I try to use the application - "Cannot open database ..... requested by the login, the login failed". I get this error even if I take the dataabse offline and detach it before quitting SSMS. And just to be clear - I'm not making any changes to the database in SSMS, I'm just looking at the data. The connection string used by VS is Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\CollectionMetricsDatabase.mdf;Integrated Security=True.
Any idea what the problem is?