When we are connecting sql server using windows authentication then we do not need to give the user name and pwd in the connection string. We have to provide the Integrated Security property to true.
SqlConnection con = new SqlConnection(“Server=servername;Integrated Security=true; Database=emp”);
Note : If your sql server is of windows authentication and if you dont provide Integrated Security you may get an error such as follows
Login failed for user ‘(null)’. Reason: Not associated with a trusted SQL Server connection.
Popularity: 1% [?]

November 14th, 2008
admin
Posted in 
