Sun Chili!Soft ASP Sun Chili!Soft
ASP Sun Microsystems

 

ADO Error Object

The ADO Error object provides specific details about each ADO error.

ADO Error Object Properties

ADO Error Object Description Property

A descriptive string associated with an error.

ADO Error Object HelpContext, HelpFile Property

The help file topic associated with an error.

ADO Error Object HelpContext, HelpFile Property

The help file associated with an error.

ADO Error Object NativeError Property

The provider-specific error code for an error.

ADO Error Object Number Property

The number that uniquely identifies an error.

ADO Error Object Source Property

The name of the object or application that originally generated the error.

ADO Error Object SQLState Property

The SQL state for a given error.

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

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:

·   The ADO Error Object Description Property contains the text of the error.

·   The ADO Error Object Number Property contains the Long integer value of the error constant.

·   The ADO Error Object Source Property identifies the object that raised the error. This is particularly useful when you have several Error objects in the Errors collection following a request to a data source.

·   The ADO Error Object HelpContext, and HelpFile Properties indicate the appropriate Microsoft Windows Help file and Help topic, respectively (if any exist), for the error.

·   The ADO Error Object SQLState Property and ADO Error Object NativeError Property properties provide information from SQL data sources.

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:

connection.Errors.Item(0)

connection.Errors(0)

Copyright 2002 Sun Microsystems, Inc. All rights reserved. Legal Notice.