views:

23

answers:

1

Hi all,

While connecting to a remote SQL Server 2005 from my C# code I get a login error (Login failed for user X) This 'user X' appears to be the windows user, instead of the one I specified in my connection string, that was a SQL Server user.

Anyone knows the problem here? The server is in another machine, and I cannot make changes on it, but I can check its configuration.

The connection string:

server=XXX; database=XXX; user id=XXX; password=XXX; Trusted_Connection=yes; 
connection timeout=30

Thanks,

+4  A: 

Trusted_Connection=yes; has the effect of using the Windows user instead of the credentials specified in the connection string. Try removing Trusted_Connection and it should work better.

Fredrik Mörk
Thanks. That was exactly the problem.