Friday, June 26, 2009

SQL Server 2005 Connection String

Assume that your SQL Server Name is SQL2K5. You allowed your database SQL2K5DB to be in mixed mode: SQL Server and Windows Authentication. In SQL Server Authentication mode, you use user name ABC and Password 123456.

One of the connection strings below you can use in your code with .NET Framework

If you want to use SQL Server Authentication, you can use:

  • Data Source=SQL2K5;Initial Catalog=SQL2K5DB;User Id=ABC;Password=123456;
  • Server=SQL2K5;Database=SQL2K5DB;User ID=ABC;Password=123456;Trusted_Connection=False;
If you want to use Windows Authentication, you can use:
  • Data Source=SQL2K5;Initial Catalog=SQL2K5DB;Integrated Security=SSPI;
  • Server=SQL2K5;Database=SQL2K5DB;Trusted_Connection=True;

No comments:

Post a Comment