I have a visual studio c# program that is supposed to run from a local computer and connect to a windows server to sql server 2008 and deliver data back to the local machine. The connection string is "Server=10.200.362.22;Database=EMPDATA;Trusted_Connection=True;
I get the error "login failed: this login is from an untrusted domain and cannot be used with windows authentication"
When I look in the server manager/diagnostics/event viewer/windows logs/security at the logs I can see my attempted login.
For targetUserName it has my local computer user name like Ann, and for targetDomainName it has Delllaptop which is what I called my computer when I set it up.
So, if I put user id in my connection string:
"Server=10.200.362.22;Database=EMPDATA;Trusted_Connection=True;User ID=user.id;
the log info doesn't change - it doesn't say targetUserName=user.idSo, of course the server does not recognize my home computer information and that's why I can't connect. But how do I fix this?
Thank you for any help. I have been trying to fix this for 2 days.
FYI: in the log for SubjectUserName and SubjectDomainName it is blank. The OS is windows server standard without hyper-V.
Trusted_Connection=True is overriding your User ID=user.id. Set it to False, and include a password. Suggested reading: ConnectionStrings.com.
Thank you, I tried that today. I tried these two connection strings: Data Source=10.200.362.22;Initial Catalog=WHLDATA;Trusted_Connection=False;User ID=username;Password=password
Data Source=10.200.362.22,1433;Initial Catalog=WHLDATA;Network Library=DBMSSOCN;Trusted_Connection=False;User ID=username;Password=password
In both cases I got:
failed to connect to server, login failed for usernameI have repeatedly read the link you included in the past few days along with many others.
Are these connection strings trying to use sql server authentication?
I might need to setup a sql server user because I can't log directly on to sql server using this username and password with sql server authentication. It's what I use to log onto the server itself.
Plus, I want to distribute this solution to many customers so it would be better if each did not have to have a username/password embedded in the connection string.
But I will do it if it's the only way.
Thanks.
Are you able to resolve this issue ? VTN
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |