Closes the connection to the data source. This is the preferred method.
[Visual Basic] Overloads Overrides Public Sub Close() [C#] public override void Close(); [C++] public: override void Close(); [JScript] public override function Close();
Exception Type | Condition |
---|---|
ConnectionAlreadyClosed | The connection was already in a closed state. |
ConnectionTooBusyToClose | A transaction is still being processed. |
This method tries to close the connection nicely by waiting for all transactions to clear first.
The following example creates a connection, opens it, begins a transaction, commits the transaction, rollsback the transaction, then closes the connection.
ADOConnection Class | ADOConnection Members | System.Data.ADO Namespace | ADOConnection.Close Overload List | Open