DB2Connection.Dispose Method

Releases the resources used by the DB2Connection.

Overload list

Name Description
Dispose(Boolean) Releases the unmanaged and, optionally, the managed resources used by the DB2®Connection.
Dispose() Inherited from Component.

Example

[Visual Basic, C#] The following example creates a DB2Connection and then disposes of it.

Note: [Visual Basic, C#] This example shows how to use one of the overloaded versions of Dispose. For other examples that might be available, see the individual overload topics.
[Visual Basic]
Public Sub DB2ConnectionHereAndGone()
    Dim myConnection As New DB2Connection()
    myConnection.Open()
    'Calling Dispose also calls DB2Connection.Close.
    myConnection.Dispose()
End Sub

[C#]
public void DB2ConnectionHereAndGone()
{
   DB2Connection myConnection = new DB2Connection();
   myConnection.Open();
   //Calling Dispose also calls DB2Connection.Close.
   myConnection.Dispose();
}