Working with Errors in ADO
Two types of errors are of interest to us when using ActiveX Data Objects. The first of these types are those ADO errors that can be trapped within the development environment by using the default exception-handling mechanism. In Visual Basic, this mechanism is accessed using the On Error statement.
The second type of error are those that are reported by a data provider and that can’t be trapped within the development environment. These errors are reported within the Errors collection of the Connection object. Within this collection, one or more Error objects are used to represent the individual errors that are reported by the data provider.
ADO Trappable Errors
Table C-1 lists the trappable errors related to ADO.
Enumeration (ADO/WFC) |
Value |
Description |
adErrBoundToCommand (BOUNDTOCOMMAND) |
3707 (&HE7B) |
The ActiveConnection property of a Recordset object cannot be changed because the Recordset object’s source is a Command object. |
|
3732 (&HE94) |
The server that owns the source row cannot complete the operation. |
|
3748 (&HEA4) |
The Connection was denied because it has different characteristics than the one already in use. |
|
3220 (&HC94) |
The supplied provider is different from the one already in use. |
|
3724 (&HE8C) |
Data ... |
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.