
The ActiveX Data Objects provide you with an interface to OLE DB data sources. Figure D.1 shows the entire ADO object model.
Figure D.1. The ActiveX Data Objects object model.
This appendix is designed as a reference to all the objects that are included in the ADO object model. The collections and objects are listed in alphabetical order with tables indicating and describing all the methods and properties available to each.
The Command object contains the properties and methods necessary to execute SQL commands using ADO. Tables D.1 and D.2 summarize the methods and properties of the Command object.
| METHOD | Description |
| Cancel | Cancels an asynchronously executing command |
| CreateParameter | Creates a new Parameter object |
| Execute | Executes the command |
| PROPERTY | Description |
| ActiveConnection | Returns or sets the active Connection object |
| CommandText | Returns or sets the command text |
| CommandTimeout | Returns or sets the timeout in seconds |
| CommandType | Returns or sets the command type |
| Name | Returns the name of the object |
| Parameters | Returns the parameters for this command |
| Prepared | Returns or sets whether to compile this command before executing |
| Properties | Returns the dynamic properties of object |
| State | Returns the current state of the object |
The Connection object manages a data provider connection in ADO. Table D.3 describes the Connection object events, Table D.4 summarizes the Connection object methods, and Table D.5 lists the Connection object properties.
| EVENT | Description |
| BeginTransComplete | Fired after the BeginTrans method is completed |
| CommitTransComplete | Fired after the CommitTrans method is completed |
| ConnectComplete | Fired after the Open method is completed |
| Disconnect | Fired after the Close method is completed |
| ExecuteComplete | Fired after the Execute method is completed |
| InfoMessage | Fired when an information message comes from the data provider |
| RollbackTransComplete | Fired after the RollbackTrans method is complete |
| WillConnect | Fired before a connection is made |
| WillExecute | Fired before the Execute method is performed |
| METHOD | Description |
| BeginTrans | Begins a transaction |
| Cancel | Cancels an asynchronous operation |
| Close | Closes an object |
| Execute | Executes a SQL statement or query |
| Open | Open the connection |
| OpenSchema | Returns a Recordset object filled with database information |
| RollbackTrans | Rolls back a transaction |
| PROPERTY | Description |
| Attributes | Indicates characteristics of the object |
| CommandTimeout | Returns or sets the timeout for the Execute method |
| ConnectionString | Returns or sets the connection string |
| ConnectionTimeout | Returns or sets the timeout to establish a connection |
| CursorLocation | Returns or sets where the cursor is created |
| DefaultDatabase | Returns or sets the default database |
| Errors | Returns the collection of Error objects raised by data providers |
| IsolationLevel | Returns or set the level of isolation for transactions |
| Mode | Returns the available permissions for modifying data |
| Properties | Returns the dynamic properties for the object |
| Provider | Returns the name of the data provider |
| State | Returns the current state of the object |
| Version | Returns the ADO version number |
The Errors collection and Error object manage the data provider generated errors for a Connection object. Tables D.6 and D.7 list the methods and properties for the Errors collection. Table D.8 lists the properties for the Error object.
| METHOD | Description |
| Clear | Clears the collection |
| Refresh | Refreshes the items in the collection |
| PROPERTY | Description |
| Count | Returns the number of items in the collection |
| Item | Returns the specified object from the collection |
| PROPERTY | Description |
| Description | Returns the description of the error |
| HelpContext | Returns a Help Context Id if a HelpFile is available |
| HelpFile | Returns the name of a help file where help on the error is available |
| NativeError | Returns the error number reported by the underlying API or interface |
| Number | Returns the error number |
| Source | Returns the name of the source of the error |
| SQLState | Returns the five-character ANSI standard error |
The Fields collection and Field object are the columns or fields returned in a Recordset object. Table D.9 summarizes the methods of the Fields collection. Table D.10 describes the properties of the Fields collection. Tables D.11 and D.12 lists the methods and properties of the Field object.
| METHOD | Description |
| Append | Appends an object to the collection |
| Delete | Deletes an object from the collection |
| Refresh | Refreshes the items in the collection |
| PROPERTY | Description |
| Count | Returns the number of items in the collection |
| Item | Returns the specified object from the collection |
| METHOD | Description |
| AppendChunk | Appends data to the object's value |
| GetChunk | Returns a portion of data from the object's value |
| PROPERTY | Description |
| ActualSize | Returns the size of the field |
| Attributes | Indicates characteristics of the object |
| DataFormat | Returns or sets the stdDataFormat object |
| DefinedSize | The defined size of the field |
| Name | The name of the object |
| NumericScale | Returns or sets the number of decimal places to which numeric values will be resolved |
| OriginalValue | Returns the values of the field when the Recordset was first opened |
| Precision | Returns or sets the maximum number of digits used to represent values |
| Properties | Returns the dynamic properties for the object |
| Type | Returns the datatype |
| UnderlyingValue | Returns the object's current value in the database |
| Value | Returns the object's current value in the Recordset |
The Parameters collection and Parameter object are used with the Command object to execute stored procedures. Tables D.13 and D.14 list the methods and properties for the Parameters collection. Table D.15 lists the method for the Parameter object, and Table D.16 lists the properties of the Parameter object.
| METHOD | Description |
| Append | Appends an object to the collection |
| Delete | Deletes an object from the collection |
| Refresh | Refreshes the items in the collection |
| PROPERTY | Description |
| Count | Returns the number of items in the collection |
| Item | Returns the specified object from the collection |
| METHOD | Description |
| AppendChunk | Appends data to the object's value. |
| PROPERTY | Description |
| Attributes | Indicates characteristics of the object |
| Direction | Returns or sets the direction of the parameter |
| Name | The name of the object |
| NumericScale | Returns or sets the number of decimal places to which numeric values will be resolved |
| Precision | Returns or sets the maximum digits used to represent values |
| Properties | Returns the dynamic properties for the object |
| Size | Returns the maximum size of the object |
| Type | Returns the datatype |
| Value | Returns the object's value |
The Properties collection and the Property object manage dynamic characteristics for an ADO object. Tables D.17 and D.18 list the methods and properties of the Properties collection. Table D.19 lists the properties of the Property object.
| METHOD | Description |
| Refresh | Refreshes the items in the collection |
| PROPERTY | DESCRIPTION |
| Count | Returns the number of items in the collection |
| Item | Returns the specified object from the collection |
| PROPERTY | Description |
| Attributes | Indicates characteristics of the object |
| Name | The name of the object |
| Type | Returns the datatype |
| Value | Returns the object's value |
The Recordset object handles the rows returned from an opened table or executed query. Tables D.20, D.21, and D.22 describe the events, methods, and properties of the Recordset object.
| EVENT | Description |
| EndOfRecordset | Fired when the end of the Recordset is reached |
| FetchComplete | Fired when the entire Recordset is fetched |
| FetchProgress | Fired to indicate the progress of the data fetch |
| FieldChangeComplete | Fired after a field is changed |
| MoveComplete | Fired after the Recordset moves to another record |
| RecordChangeComplete | Fired after a record is changed |
| RecordsetChangeComplete | Fired after the Recordset is changed |
| WillChangeField | Fired before a field's value is changed |
| WillChangeRecord | Fired before a record is changed. |
| WillChangeRecordset | Fired before the Recordset is changed. |
| WillMove | Fired before the Recordset moves to another record. |
| METHOD | Description |
| AddNew | Adds a new record to the object |
| Cancel | Cancels an asynchronously executing command |
| CancelBatch | Cancels changes before BatchUpdate has been called |
| CancelUpdate | Cancels changes before an Update has been called |
| Clone | Returns a duplicate Recordset |
| Close | Closes the object |
| CompareBookmarks | Compares two bookmarks |
| Delete | Deletes from the Recordset |
| Find | Finds a record in the Recordset |
| GetRows | Retrieves records into an array |
| GetString | Retrieves records into a string |
| Move | Moves the position of the current record |
| MoveFirst | Moves to the first record of the Recordset |
| MoveLast | Moves to the last record of the Recordset |
| MoveNext | Moves to the next record of the Recordset |
| MovePrevious | Moves to the previous record of the Recordset |
| NextRecordset | Clears current Recordset and moves to the next Recordset |
| Open | Opens the object |
| Requery | Refreshes the Recordset by re-executing the underlying query |
| Resync | Refreshes the Recordset to the current database values |
| Save | Saves the Recordset to a file |
| Supports | Returns whether the object supports a particular function |
| Update | Saves the changes to the current row to the database |
| UpdateBatch | Saves the changes of the current batch to the database |
| PROPERTY | Description |
| AbsolutePage | Returns or sets the page of the current record |
| AbsolutePosition | Returns or sets the current record position by ordinal |
| ActiveCommand | Returns the command object that created the Recordset |
| ActiveConnection | Returns the active connection used by the Recordset |
| BOF | Returns whether the current record position is before the beginning of the Recordset |
| Bookmark | Returns or sets a bookmark for the current record |
| CacheSize | Returns or sets the number records that will be cached in local memory |
| CursorLocation | Returns or sets where the cursor will be created |
| CursorType | Returns or sets the type of cursor |
| DataMember | Returns or sets the data member to retrieve from the object referenced by the datasource property |
| DataSource | Returns or sets the object containing data the Recordset represents |
| EditMode | Returns the editing status of the current record |
| EOF | Returns if the current record position is past the end of the Recordset |
| Fields | Returns the collection of Field object's in the Recordset |
| Filter | Returns or sets the filter for data |
| LockType | Returns or sets the locking strategy |
| MarshalOptions | Returns or sets how the Recordset should be marshaled using DCOM |
| MaxRecords | Returns or sets the maximum number of records to return |
| PageCount | Returns the number of pages the Recordset contains |
| PageSize | Returns or sets the size of the pages |
| Properties | Returns the dynamic properties for the object |
| RecordCount | Returns the number of records |
| Sort | Returns or sets the sort criteria |
| Source | Returns or sets the source of the data |
| State | Returns the current state of the object |
| Status | Returns the status with regards to batch updates |
| StayInSync | Returns or sets whether the parent row should change when underlying child rows change in a hierarchical Recordset |
© Copyright, Macmillan Computer Publishing. All rights reserved.