Updating Connection Strings¶
The primary database connection is defined in web.config under <connectionStrings>.
MyCompany Connection String¶
To update¶
-
Replace SERVERNAME\INSTANCE with the actual SQL Server instance.
-
Replace DATABASE_NAME with the actual database name.
-
Replace DB_USER and DB_PASSWORD with appropriate credentials.
Best Practices¶
-
Use a dedicated login with least privilege necessary (typically db_owner on this database only).
-
Avoid using highly privileged accounts (e.g. sa).
-
In some environments, Windows authentication may be used instead of SQL logins.
-
After changes, restart the application pool (if needed) and test connectivity by loading the site.
Example structure¶
<connectionStrings>
<clear />
<add name="MyCompany"
connectionString="Data Source=SERVERNAME\INSTANCE;Initial Catalog=DATABASE_NAME;User ID=DB_USER;Password=DB_PASSWORD;"
providerName="System.Data.SqlClient" />
</connectionStrings>