Name

OleDbConnection

Synopsis

This class represents a connection to an OLE DB data source, which can be opened (in order to execute a SQL command) or closed. For information about the basic OleDbConnection methods and properties, refer to the reference for the System.Data.IDbConnection interface, which OleDbCommand implements. If an error is generated by the data source when performing an operation over a connection, an OleDbException is thrown.

In addition, the OleDbConnection provides some additional provider-specific read-only properties, such as Provider (the name of the provider, as in MSDASQL), and ServerVersion (a string with the data source version in the format xx.xx.xxxx). The version maps to the OLE DB DBPROP_DBMSVER property. If this isn’t supported by the underlying OLE DB provider, an empty string is returned.

The OLE DB provider implements connection pooling through COM+, which allow connections to be reused on the same computer, provided clients use an identical connection string.

public sealed class OleDbConnection : System.ComponentModel.Component, ICloneable, System.Data.IDbConnection {

// Public Constructors

   public OleDbConnection( );  

   public OleDbConnection(string connectionString);  

// Public Instance Properties

   public string ConnectionString{set; get; }                  // implements System.Data.IDbConnection

   public int ConnectionTimeout{get; }                         // implements System.Data.IDbConnection

   public string Database{get; }                               // implements System.Data.IDbConnection

   public string DataSource{get; ...

Get ADO.NET in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.