I ran into this just now with SQLSERVER 2012 (or actually SQLEXPRESS but I think the principle's the same). I created a connection string and attached an .MDF file to my Visual Studio C# web application project. When I try to run the solution, I get this error:
Cannot open database "DB" requested by the login. The login failed.
Login failed for user 'PC-NAME\'My windows login'
I'm not that concerned about security right now, this is just a prototype, so I simply want to use my everyday Windows credentials to access the "server" (actually the same notebook), and then log into the database specific to my application.
So having seen the above error message I fire up SSMS and make sure 'PC-NAME\My windows login' is listed among the logins. It is indeed listed, with pretty much every possible role and privilege. I check the application database "DB". Aha! there's no such user, or so it seems. Yet when I try to add user 'PC-NAME\My windows login' to the app database, I now get this error:
The login already has an account under a different user name. (Microsoft SQL Server, Error: 15063)
So now what? I think the app database user 'dbo' is the user in question, but I can't delete that users because, apparently, it's also a schema for the database.