System.Data.OleDb.OleDbConnection.Close Method

Closes the connection to the data source.


public override void Close ()


The OleDbConnection.Close method rolls back any pending transactions. It then releases the connection to the connection pool, or closes the connection if connection pooling is disabled. If OleDbConnection.Close is called while handling a System.Data.Common.DbConnection.StateChange event, no additional System.Data.Common.DbConnection.StateChange events are fired.

An application can call OleDbConnection.Close more than one time. No exception is generated.


Do not call OleDbConnection.Close or Dispose on an System.Data.OleDb.OleDbConnection, an System.Data.OleDb.OleDbDataReader, or any other managed object in the Finalize method of your class. In a finalizer, you should only release unmanaged resources that your class owns directly. If your class does not own any unmanaged resources, do not include a Finalize method in your class definition. For more information, see Garbage Collection.


Namespace: System.Data.OleDb
Assembly: System.Data (in System.Data.dll)
Assembly Versions: 1.0.5000.0,