i am doing an application at school and i always have this error message:

Cannot open database "users" requested by the login. The login failed. Login failed for user 'SERVER\Student'.

what is the possible solution for this? thanks :)

Recommended Answers

All 3 Replies

this is my sqlconnection string that i used:

Dim conn As New SqlConnection("Server=SERVER/SQLEXPRESS;Database=users;integrated security=true;")

Try SERVER\SQLEXPRESS (back slash). When I connect to the SQLEXPRESS on my computer I use

JIM-PC\SQLEXPRESS

If you are connecting to a SQLEXPRESS on another machine then you will have to check that you have been granted access rights for you as currently logged on. If not then access rights will have to be set up (because you are using integrated security). Or you can use a userid/password that has been set up in SQLEXPRESS in which case you will have to specify the userid & password in the connection string.

Try to create a user id from sql management studio > security> logins node. Right click logins then new select new login. Grant needed permission to that user then change your connection string to

Dim conn As New SqlConnection("Server=youpcname\SQLEXPRESS;Database=users;User Id = yourcreatedlogin, Pass = yourpassword;")
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.