Contents Index Topic Contents |
Connection Object
A Connection object represents an open connection to a data source.
Collections
Methods
BeginTrans, Close, CommitTrans, Execute, Open, OpenSchema, RollbackTrans
Properties
Attributes, CommandTimeout, ConnectionString, ConnectionTimeout, CursorLocation, DefaultDatabase, IsolationLevel, Mode, Provider, State, Version
Remarks
A Connection object represents a unique session with a data source. In the case of a client/server database system, it may be equivalent to an actual network connection to the server. Depending on the functionality supported by the provider, some collections, methods, or properties of a Connection object may not be available.
Using the collections, methods, and properties of a Connection object, you can do the following:
- Configure the connection before opening it with the ConnectionString, ConnectionTimeout, and Mode properties.
- Set the CursorLocation property to invoke the Client Cursor Provider, which supports batch updates.
- Set the default database for the connection with the DefaultDatabase property.
- Set the level of isolation for the transactions opened on the connection with the IsolationLevel property.
- Specify an OLE DB provider with the Provider property.
- Establish, and later break, the physical connection to the data source with the Open and Close methods.
- Execute a command on the connection with the Execute method and configure the execution with the CommandTimeout property.
- Manage transactions on the open connection, including nested transactions if the provider supports them, with the BeginTrans, CommitTrans, and RollbackTrans methods and the Attributes property.
- Examine errors returned from the data source with the Errors collection.
- Read the version from the ADO implementation in use with the Version property.
- Obtain schema information about your database with the OpenSchema method.
Note To execute a query without using a Command object, pass a query string to the Execute method of a Connection object. However, a Command object is required when you want to persist the command text and re-execute it, or use query parameters.
You can create Connection objects independently of any other previously defined object.
See Also
Using OLE DB Providers with ADO
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.