I am using SQL Server 2008 R2 Express and the "SQL Server and Windows Authentication" mode in my database. I can open the database using Enterprise Manager, but when I run my aspx application, I get:
Cannot open database "PersonnelPro" requested by the login. The login failed.
My web.config connection string is:
<add name="dbString"
connectionString="Provider=sqloledb;Data Source=AREA51\SQLEXPRESS;Initial Catalog=PersonnelPro;User Id= ****;Password= ****" />`
I searched the web and SO, but could not find a solution. Any ideas what would be causing this issue?
Update:
Looking into SQL log files ("C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\Log"), I find this:
2012-12-21 05:58:00.97 Logon Error: 18456, Severity: 14, State: 38.
2012-12-21 05:58:00.97 Logon Login failed for user 'PersonnelPro'. Reason: Failed to open the explicitly specified database. [CLIENT: <named pipe>]
This web application is by a 3rd party company. So technically, I only need to configure my web.config file and it should work.
Remove the space after the '=' sign for User Id and Password. I think it is being interpreted as part of the value.
Update:
The new error message you posted (Failed to open the explicitly specified database.) can mean one of two things:
exec sp_helpuser 'username'
in the DB.