Click here to Skip to main content
15,905,915 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have used the following connection string.
_HR = new SqlConnection(String.Format("Data Source=SERVER;Initial Catalog=HR;Persist Security Info=True;User ID=sa;Password=123"));
I want to remove password and should use SQL Windows Authentication. How can I modify my connection string. Thanks in advance.
Posted

1 solution

Try Trusted_connection:
C#
HR = new SqlConnection(String.Format("Data Source=SERVER;Initial Catalog=HR;Persist Security Info=True;Trusted_Connection=True"));

For more information, see: SqlConnection.ConnectionString Property[^]
 
Share this answer
 
v2
Comments
Maciej Los 8-Sep-15 12:24pm    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900