Error : "Cannot open database XXX requested by login."

M

Mr.KisS

Hello.

I'm under Windows XP PRO SP1, IIS 5.1 ans SQL SERVER 2005
Express. When i try to open a connexion with :
<connectionStrings>
<add name="AppCnxStr"
connectionString="Server=KLEO\SQLEXPRESS;Integrated
Security=True;Database=C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Data\wizou.mdf"
providerName="System.Data.SqlClient" />
</connectionStrings>

I GET THIS ERROR :
____________________
Cannot open database 'C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Data\wizou.mdf' requested by login.
Login fails. Login failed for user 'KLEO\ASPNET'.
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.

Exception Details: System.Data.SqlClient.SqlException:
Cannot open database 'C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Data\wizou.mdf' requested by login.
Login fails. Login failed for user 'KLEO\ASPNET'.
____________________
The file wizou.mdf exists. What have I to do? (sql server
2005!!) If i must changes something, plz tell me step by
step (i'm novice witg sql/asp.net 2).

Plz answer if u know ;)

Regards.

(msn: (e-mail address removed))
 
S

stefano mostarda

Hi,

As far as I know in the database parameter of the connection string, you
don't have to put the physical database file, but the logical name of
the database in sqlServer.

HTH,
Stefano Mostarda MCP
Rome Italy
 
T

Teemu Keiski

This is correct. Developer shouldn't usually even know anything about
database's physical wrokings. Anyway, using logical name is the preferred
way and that's how it's also in all samples on the web.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top