Name

Connection.Close Method — (Versions 2.0, 2.1, 2.5, 2.6)

Synopsis

                     connection.Close

The Close method is used to close either a Connection or Recordset object, including any dependent objects that they may have.

Description

The Close method terminates a connection with a data source. After a Connection object is closed, properties can be adjusted, and the object can be opened again. Calling methods that require a connection while the Connection object is closed generates an error.

Closing a Connection object that one or more Recordset objects were created from causes those Recordset objects to close as well. All pending changes are lost. If there is a pending transaction, an error occurs.

Closing a Connection object does not remove it from memory, it only frees the resources that it is using. To remove the Connection object from memory in Visual Basic, set it to Nothing.

Get ADO: ActiveX Data Objects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.