Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have an (.Net Console App) EXE which connects to various SQL databases using SQL server Authentication with appropriate credentials. Now there is change required in the EXE to use windows authentication and use the Network Credentials to log in SQL server. (All SQL servers are on diffrent locations) I have the network credentials with me, but am confused how to connect to remote SQL server using these and retrive data from that. Please help.

share|improve this question

migrated from stackoverflow.com Feb 8 '12 at 13:44

This question came from our site for professional and enthusiast programmers.

    
Which way are you using to connect to sql server? Entity Framework? Linq to Sql? Ado.NET? –  Vinicius Ottoni Feb 8 '12 at 13:41

3 Answers 3

up vote 6 down vote accepted

The only change required is in the connection string: remove the User ID=...; and Password=...;, and add Integrated Security=SSPI; instead.

More information can be found here.

share|improve this answer

You need to modify your connection strings to follow the below format for a Trusted Connection:

Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;

And then run your application in the security context of the domain user.

share|improve this answer

Your app.config file should use Integrated Security in your connections strings.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.