Connection Object Overview
Connection object, like all provider-specific
ADO.NET objects, comes in more than one version. You use the version
that’s tailored for your specific data source. Here
are two examples:
System.Data.SqlClient.SqlConnectionallows you to connect to a SQL Server database (Version 7.0 or later).
System.Data.OleDb.OleDbConnectionallows you to connect to almost any data source with an associated OLE DB provider.
object that accesses relational databases implements the common
System.Data.IDbConnection interface. By looking at
you’ll quickly see the small set of properties and
methods that every
Connection object is guaranteed
to support (see Tables 3-1 and 3-2). The most important of these are
Close( ) and
methods, and the
ConnectionString property, which
specifies a variety of options about the data source and how to
connect to it. All
IDbConnection properties are
A string with name-value pairs of connection settings. These settings often include information such as the user to log in and the location of the database server. This is the only writeable property.
The time to wait for a connection to open before failing with a
provider-specific exception (such as