Alex Rivera | Logout

Does OledbConnection.Dispose() close the connection?

Asked 2012-08-20T08:10:26.237
8

Possible Duplicate:
Is there any need to close a DbConnection if a using clause is used?

Does OledbConnection.Dispose() close the connection?

I am aware that SqlConnection does but what about OledbConnection?

Edit
Report

1 Answer

1

Here is the ultimate proof.. the actual code of the Dispose method, taken using a reflector:

// System.Data.OleDb.OleDbConnection
protected override void Dispose(bool disposing)
{
    if (disposing)
    {
        this._userConnectionOptions = null;
        this._poolGroup = null;
        this.Close();
    }
    this.DisposeMe(disposing);
    base.Dispose(disposing);
}
answered 2012-08-20T08:16:01.620

Your Answer