ONE Active Server Pages Product Home Page Developer Site Version


ADO Error Object Remarks

Any operation involving ADO objects can generate one or more provider errors. As each error occurs, one or more Error objects are placed in the ADO Errors Collection of the ADO Connection Object. When another ADO operation generates an error, the Errors collection is cleared, and the new set of Error objects are placed in the Errors collection.

Note icon Note Each Error object represents a specific provider error, not an ADO error. ADO errors are exposed to the run-time exception handling mechanism. For example, in Microsoft Visual Basic, the occurrence of an ADO-specific error will trigger an On Error event and appear in the Err object. For a complete list of ADO errors, see Appendix B.

Read the Error object's properties to obtain specific details about each error:

ADO supports the return of multiple errors by a single ADO operation to allow for error information specific to the provider. To obtain this error information in an error handler, use the appropriate error-trapping features of the language or environment you are working with, then use nested loops to enumerate the properties of each Error object in the Errors collection.

ADO clears the OLE Error Info object before making a call that could potentially generate a new provider error. However, the Errors collection on the Connection object is cleared and populated only when the provider generates a new error, or when the ADO Collections Clear Method is called.

Some properties and methods return warnings that appear as Error objects in the Errors collection but do not halt a program's execution. Before you call the ADO Recordset Object Resync Method, ADO Recordset Object UpdateBatch Method, or ADO Recordset Object CancelBatch Method methods on an ADO Recordset Object, or before you set the ADO Recordset Object Filter Property on a Recordset object, call the ADO Collections Clear Method on the Errors collection so that you can read the Count property of the Errors collection to test for returned warnings.

If there is no valid Connection object when using Microsoft Visual Basic and VBScript, retrieve error information from the Err object.

To refer to an Error object in a collection by its ordinal number, use either of the following syntax forms: