Name

Command.ActiveConnection Property — (Versions 2.0, 2.1, 2.5, 2.6)

Synopsis

                     Command.ActiveConnection = ConnectionString
Set Command.ActiveConnection = ConnectionObject
                  

The ActiveConnection property specifies the Connection object for the current Command object.

Datatype

String or Variant (containing the current Connection object)

Description

The ActiveConnection property can be set to either a String, representing a connection string, or a Variant, representing an open Connection object.

The ActiveConnection property can be set to either a String or a reference to a Connection object. If a String value is used, then it should be a valid connection string that could be passed to the ConnectionString property of a Connection object. You must set the ActiveConnection property before you attempt to execute a Command object. Before it is set, the value of the ActiveConnection property is a Null object reference, by default.

If you set the ActiveConnection property to a closed Connection object, ADO will generate an error. If you set it to Nothing, ADO will disassociate the Command object from the Connection object and release any resources that are associated with the data source. If the ActiveConnection property is set to either Nothing or a different Connection object, those Parameter objects that were supplied by the data provider, residing in the Command’s Parameters collection class, will be lost. However, those Parameter objects that were manually added to the Parameters collection ...

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.