views:

53

answers:

3

Greetings.

I'm writing a web application that is supposed to connect to a SQL Server database; the connection is formed from the following database string:

<add key="DatabaseConnectionString" value="server=DEVPC1\SQLEXPRESS;uid=USERID;pwd=PASSWORD;database=DATABASE"/>

However, whenever I try and run the web application, I get a connection error, specifically:

An error occurred attempting this login:
Login failed for user 'USERID'.

Any suggestions on how to go about debugging this? I'm not really familiar with SQL, so any suggestions would be greatly appreciated.

+2  A: 

This is is not a coding error, it indicates the authentication credentials are wrong. Are you able to connect with the database using these credentials using SSMS? Are you sure you are connect to the right server?

RedFilter
for connecting to a local sql express, the database credentials are mostly not known by a database administrator
Tim Mahy
Good point - OP should have a talk with themselves then! I updated my response.
RedFilter
I appear to be unable to log in through SSMS with those credentials. I then created a new login (User: theAdmin; pwd: password) and that was unable to connect to the server using SQL authentication either. I got the following error: Cannot connect to DEVPC1\SQLEXPRESS.Login failed for user 'theAdmin'. (Microsoft SQL Server, Error: 18456)
Raven Dreamer
+2  A: 

it will help if you replace USERID and PASSWORD with your actual credentials along with "DATABASE" (unless this is the name of your database ofcourse :) )

Tim Mahy
I would assume he was obfuscating his credentials as not to let the internets know his stuff.
Tommy
let's hope so :)
Tim Mahy
A: 

Does user exist in the Db? ConnectionStrings.com is a good reference.

gnome