Skip to content Skip to sidebar Skip to footer

Cannot Open Database "dbname" Requested By The Login. The Login Failed

I'm trying to make a connection to sql server database(hosted on localhost) but keep getting the error mentioned in the title. Application('ConnectionString') = 'Provider=SQLOL

Solution 1:

You are putting it wrong, change to:

Application("ConnectionString") = "Provider=SQLOLEDB.1;Integrated Security=SSPI;
        Persist Security Info=False;User ID=dbadmin;Initial Catalog=mydb;
        Data Source=localhost\SQLExpress;Password=dbadmin"

(Linebreaks added for legibility)

When in doubt, create a .UDL file, construct the ConnectionString using the GUI, and then copy paste the ConnectionString (opening the file with notepad)

Post a Comment for "Cannot Open Database "dbname" Requested By The Login. The Login Failed"