Monday, March 12, 2012

Problem of connecting to SQL server

Hi

When I try to connect to SQL Database, I always got some errors following by:

Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection

My code:

SqlConnection objConn = new SqlConnection("server=DEVELOPMENT2;" +
"Database=Job_Control;" +
"User ID=sa; Password=!password1");

objConn.Open();

I don`t know what is the problem

Regards

William

Is SQL authentication enabled for that SQL Server, or is it Windows authentication only?
|||If SQL authentication *is* enabled, try, just for kicks:
SqlConnection objConn = new SqlConnection("server=DEVELOPMENT2;" +
"Database=Job_Control;" +
"uid=sa; pwd=!password1");

I'm too lazy to look and see right now if all of your parameters are valid, but I know these ones are.

No comments:

Post a Comment