The ActiveX Data Object(ADO) Connection Object is used to create an open connection to a data base. Through this open connection, you can access and manipulate a database.
The Connection object establishes a link to a database. You always use a Connection object either implicitly or explicitly when you work with a database. When you explicitly create one, you can efficiently manage one or more connections and reassign the roles that they serve in an application. By implicitly creating one you can shorten your code. Each new object that you create with an implicit connection consumes more resources. If your application has only one or two objects that each requires its own connection, implicit connections might serve your needs best. ADO lets you choose how to create and manage connections as you see fit.
A ActiveX Data Object (ADO) Connection object represents a session with a data source. In the case of client/server database system, it may represent an actual network connection to the server. Depending on the functionality of the provider, some collections, properties, and methods of the Connection object may not be available.
Execute a command as a native method of a Connection object
To execute the command, gives the command a name using the Command object Name property. Set the Command object's ActiveConnection property to the connection. Then issue a statement where the command name is used as if it were a method on the Connection object, followed by the any parameters, then followed by the Recordset object if any rows are returned. Set the Recordset properties to customize the resulting Recordset.
For example:
Dim cnn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rst As New ADODB.Recordset
...