Question - How do I use SQL authentication for connecting to SQL server

J.D. Meier, Alex Mackman, Blaine Wastell, Prashant Bansode, Andy Wigley, Kishore Gopalan

Applies to

Answer:

If you cannot use Windows authentication to SQL Server, you must use SQL authentication. To use SQL authentication:

If you connect to a SQL Server database using credentials (user name and password), your connection string looks like the following.

SqlConnectionString = "Server=YourServer\Instance;
Database=YourDatabase;uid=YourUserName;
pwd=YourStrongPassword;"

Additional Resources

Attributes

  • Author: J.D. Meier, Alex Mackman, Blaine Wastell, Prashant Bansode, Andy Wigley, Kishore Gopalan

  • Category: Data Access

  • filePath: ..\Libraries\patterns & practices Library\faq\e575c437-e82c-4d46-a6d6-0535eb183c45.xml

  • Pri: 2

  • Rule Type: Implementation

  • Source: patterns & practices Library

  • Status: Release

  • Technology: ASP.NET 2.0

  • Title: Question - How do I use SQL authentication for connecting to SQL server

  • Topic: Security

  • Type: Question and Answer

  • ID: e575c437-e82c-4d46-a6d6-0535eb183c45