Monday, February 20, 2012

Old problem, but... Cannot open user default database. Login failed. Login failed for user '

I didn't use SQL Express before, now I am trying to use it. I thinkk it is convinient if you just want to copy db files to user's machine. like this

<add name="schsecurity" connectionString="Data Source=.\SQLExpress;Integrated Security=true;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf" />

as long as user has sql express installed, he should be able to use the db once he copy the file aspnetdb.mdf over.

but when I tried it, I got

Cannot open user default database. Login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

it looks simple, SQL express can not verify user 'NT AUTHORITY\NETWORK SERVICE'

so I connect SQL express with SQL server management studio, and add the user into login of the SQL express and set the user as sysadmin. But I still get the error.

Any idea?

thanks!

I doubt it has anything to do with copying files to your machine. The default database does not have proper permissions for access. I receive the same message when attempting to log in using username and password. I know the username and password are correct. I'm not sure of how to give the default db permission for access.|||

You should not post like that, it is not helpful.

Can anyone help?

thanks

No comments:

Post a Comment