Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.

SqlClient Configuration (ASP .NET)

Aleksey Nemiro edited this page Apr 2, 2014 · 7 revisions

Special configuration for Nemiro.Data class library is not required. It is recommended add to the web.config file a connection string with name LocalSqlServer.

<configuration>
  <connectionStrings>
    <remove name="LocalSqlServer"/>
    <add  name="LocalSqlServer" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=example;Trusted_Connection=True;"/>
  </connectionStrings>
</configuration>

This will avoid specifying the connection string in a code.

NOTE: Before adding the connection string, you need to remove the LocalSqlServer, because the LocalSqlServer it's default connection string of the .NET Framework.

NOTE: The connection string (Data Source=.\SQLEXPRESS;Initial Catalog=example;Trusted_Connection=True;) is shown only for example. You must set your own connection string.

Additional settings

You can use additional parameters to configure the behavior of the SqlClient class.