Cannot open database
I was just working on a SQL rollback script verification tool when I got the following error:
System.Data.SqlClient.SqlException: Cannot open database <database> requested by the login. The login failed.Login failed for user <user>
the usual reason for this is a bad connection string, or a user that doesn't have permissions, but in my case it was that I was trying to create a new db file (to run the scripts against), and the directory did not exist in which I was trying to make my file.
Creating the directory was enough to get it to work.
System.Data.SqlClient.SqlException: Cannot open database <database> requested by the login. The login failed.Login failed for user <user>
the usual reason for this is a bad connection string, or a user that doesn't have permissions, but in my case it was that I was trying to create a new db file (to run the scripts against), and the directory did not exist in which I was trying to make my file.
Creating the directory was enough to get it to work.
Comments
Post a Comment