OleDbConnection |
marshal by reference, disposable |
System.Data.OleDb (system.data.dll) |
sealed class |
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; }
public string Provider{get; }
public string ServerVersion{get; }
public ConnectionState State{get; } // implements System.Data.IDbConnection
// Public Static Methods
public static void ReleaseObjectPool( );
// Public Instance Methods
public OleDbTransaction BeginTransaction( );
public OleDbTransaction BeginTransaction(System.Data.IsolationLevel isolationLevel);
public void ChangeDatabase( string value); // implements System.Data.IDbConnection
public void Close( ); // implements System.Data.IDbConnection
public OleDbCommand CreateCommand( );
public void EnlistDistributedTransaction(System.EnterpriseServices.ITransaction transaction);
public DataTable GetOleDbSchemaTable(Guid schema, object[ ] restrictions);
public void Open( ); // implements System.Data.IDbConnection
// Protected Instance Methods
protected override void Dispose( bool disposing); // overrides System.ComponentModel.Component
// Events
public event OleDbInfoMessageEventHandler InfoMessage;
public event StateChangeEventHandler StateChange;
}
Hierarchy
System.Object
System.MarshalByRefObject System.ComponentModel.Component(System.ComponentModel.IComponent, System.IDisposable)
OleDbConnection(System.ICloneable, System.Data.IDbConnection)
Returned By
OleDbCommand.Connection
, OleDbTransaction.Connection
Passed To
OleDbCommand.{Connection
, OleDbCommand( )}
, OleDbDataAdapter.OleDbDataAdapter( )
|