When connecting your ASP.NET application to a Microsoft SQL Server, the connection string in your web.config
file must be properly formatted based on your server settings and SQL version.
<connectionStrings>
<add name="[ConnectionStringName]"
connectionString="Data Source=[YourSqlServer]; Initial Catalog=[YourDatabaseName]; User ID=[YourUsername]; Password=[YourPassword]"
providerName="System.Data.SqlClient" />
</connectionStrings>
[ConnectionStringName]
– Name your app expects (e.g., SiteSqlServer
, CommerceTemplate
)
[YourSqlServer]
– IP address or hostname of your SQL Server
[YourDatabaseName]
– The name of your database
[YourUsername]
– SQL Server login username
[YourPassword]
– Password for the SQL Server login
SQL Server 2012
SQL Server 2014
SQL Server 2016
SQL Server 2017
SQL Server 2019
SQL Server 2022
All of the above versions support the same format using System.Data.SqlClient
.
Do not include a trailing semicolon (;
) at the end of the connection string. This can cause parsing issues.
Make sure your SQL Server IP address is correctly set in your hosting control panel (e.g., Plesk, SOLIDCP).
All credentials must match the ones configured when your database was created in the panel.
Application | Connection String Name |
---|---|
DotNetNuke | SiteSqlServer |
Commerce Starter Kit 2.0 | CommerceTemplate , LocalSqlServer |
Custom ASP.NET App | Varies by developer setup |
For DotNetNuke, also check the <appSettings>
section for a key named SiteSqlServer
.