Initializes a new instance of the SqlClient class.
Namespace: Nemiro.Data.SqlAssembly: Nemiro.Data (in Nemiro.Data.dll) Version: 2.11.4.126 (2.11.4.126)
Syntax
Parameters
- connectionString
- Type: System String
Connection string. For example: user id=;password=;data source=(local);initial catalog= Default value: LocalSqlServer (key name of the connection string in the.config file)
Examples
The following example creates an instance of the SqlClient class with the parameter name in the configuration file that contains the connection string to the SQL Server.
using (SqlClient client = new SqlClient("MyConnectionString")) { // ... }
Here's the file web.config:
<configuration> <connectionStrings> <add name="LocalSqlServer" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=example;Trusted_Connection=True;" /> </connectionStrings> </configuration>
See Also