-
August 15th, 2011, 06:49 PM
#1
Cannot open database "DatabaseName" requested by the login. The login failed.
Greetings,
I have a local environment on my Windows 7/SQL Express 2008/IIS 7 laptop. I am working on getting some asp code with vb script to work.
I am working on a project from work and need to setup a test/development area.
Here is the error and part of the code:
Error:
Microsoft OLE DB Provider for SQL Server error '80004005'
Cannot open database "DBName" requested by the login. The login failed.
/servermgmt/framelist.asp, line 51
Code:
<%@ Language=VBScript %>
<%
Dim sConnection, objConn , objRS
sConnection = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DBName;Data Source=LAPTOP1\SQLEXPRESS;"
Set objConn = Server.CreateObject("ADODB.Connection") "****** Line 51 ******"
objConn.Open(sConnection)
Set objRS = objConn.Execute("SELECT SERVER_NAME, Primary_IP, STATUS, FROM server WHERE STATUS <> 'Decommissioned' ORDER BY SERVER_NAME")
additional code....
%>
Let me know if more information is needed.
The page name is serverlist.asp.
-
August 15th, 2011, 06:59 PM
#2
Re: Cannot open database "DatabaseName" requested by the login. The login failed.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
August 16th, 2011, 02:55 PM
#3
Re: Cannot open database "DatabaseName" requested by the login. The login failed.
OK, after an exhausting research on the web I found a quick resolution. This may not be the right solution but it worked for me.
Under Microsoft SQL Server Management Studio > Security > Logins > Builtin\Users...right click and go to Properties > User Mapping > select DB and select under Database role membership for: DB db_owner.
As soon as I did this, I was able to run my asp page.
Hope this helps.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|