I've set up a login page for a .NET web application but when I try to log one of the users on my database in I get this error.
Cannot open database "SampleLaundrySystem" requested by the login. The login failed. Login failed for user
After doing some research I found I ran this query in an attempt to give myself access to the server
EXEC sp_grantlogin 'MyMachineName\ASPNET' /* Give the ASPNET account access to DB*/
EXEC sp_grantdbaccess 'MyMachineName\ASPNET' /* Give the ASPNET account full privileges to DB*/
EXEC sp_addrolemember 'db_owner', 'MyMachineName\ASPNET'
The above still didn't work and I'm getting an error saying the 'MyMachineName' was not found.
I need help on how to get this sorted or pointers to what I'm doing wrong. Please find below my connection string:
<add name="SampleName"
connectionString="Server=localhost\SqlExpress;Database=SampleLaundrySystem;Integrated Security=True"
providerName="System.Data.SqlClient" />
Thanks in advance for everything.
change integrated security =SSPI
follow this link: http://www.connectionstrings.com/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.