Wednesday, May 16, 2007

Connection string with Windows and SQL Server authentication...

Useful one thought of sharing this - Here's a whole site with information on just Connection strings for different databases.
ConnectionStrings.com

Quick one for .net/SQL -
Integrated Security=True - If you want to use windows authentication (takes windows credentials)
SqlConnection connection = new SqlConnection("Data Source=;Initial Catalog=;Integrated Security=True; ");

Integrated Security=False - If you want to use SQL server authentication (provide user name and password and this loging shud be present in SQL 2005)
SqlConnection connection = new SqlConnection("Data Source=;Initial Catalog=;Integrated Security=False; Uid = <'sql login name'> Pwd =<'sql pwd'> ");
Credits - Gaurav for healthy discussion. Cheers - Dipesh

No comments: