Working with Connection Strings
A connection string contains initialization information that is passed as a parameter from a data provider to a data source. The syntax varies depending on the data provider, and the connection string is parsed immediately after being set. Syntax errors will generate a run-time exception, but other errors can be found only after the data source has validated the information in the connection string. Once validated, the data source sets various connection string options that enable the connection and allow it to be opened. The .NET Framework 2.0 provides new capabilities for working with connection strings, ranging from the introduction of new keywords to the ConnectionStringBuilder classes which facilitate building valid connection strings at runtime based on user input.
In This Section
- Building Connection Strings
Describes how to use the ConnectionStringBuilder classes to construct valid connection strings at runtime.
- Using Connection String Keywords
Describes some common connection string keywords.
- Storing and Retrieving Connection Strings
Describes how to store and retrieve connection strings in configuration files.
- Configuring Provider-Specific Connection Strings
Describes provider-specific connection strings for SqlClient, OracleClient, OleDb and Odbc.