COLLECTION:  Connection::Errors Collection

The Errors Collection contains all of the Error objects that were created as the result of a single failure involving the provider. Each time a failure occurs involving the provider, the Errors Collection is cleared and the new Error objects that have been created are inserted into the collection.
 
Only the Connection object has an Errors Collection. The collection is numbered (indexed) starting at zero.
 
Each Error object contains a specific provider (not an ADO) error or warning. ADO errors are handled differently. When an ADO error occurs, it generates a run-time exception-handling mechanism.
 
While provider warnings usually do not halt normal program execution, these warnings will have to be dealt with under certain circumstances. It is recommended that you apply the Clear method to the Errors Collection before you call any of the following:
 
Object Method or Property
Connection Open method
Recordset CancelBatch method
Recordset Filter property
Recordset Resync method
Recordset UpdateBatch method

 
The Errors Collection has access to two properties and two methods.
 
PROPERTIES
 
Count Property
The Count property returns a long value that is the number of items in the collection. The counting starts at zero. You can use this value to loop through the collection by iterating from zero to the value of Count minus one.
 
Code (VBScript):
intCountNumber = objConnection.Errors.Count
 
You can also use the VB/VBScript For Each ... Next statement.
 
Code (VBScript):
For Each objProperty In objConnection.Errors
   ' place code here to manipulate each item in collection
Next

 
Item Property
The Item property is used to return a specific member of the Errors Collection. The Index parameter is the position (ordinal) number.
 
Code (VBScript):
MyError = objConnection.Errors.Item(5)
Or:
MyError = objConnection.Errors(5)
 
METHODS
 
Clear Method
The Clear method is automatically called each time a provider failure occurs to remove all previous Error objects that may exist in the Errors Collection before setting the new error information.
 
Code (VBScript):
objConnection.Errors.Clear
 
Refresh Method
The Refresh method updates the Property objects in the Properties Collection with the dynamic property information specific to the provider. It is quite possible that the provider has dynamic properties that are not supported by ADO.
 
Code (VBScript):
objConnection.Errors.Refresh
 

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information