INFO: Extracting Error Information from ADO in VB (167957)
The information in this article applies to:
- ActiveX Data Objects (ADO) 1.0
- ActiveX Data Objects (ADO) 1.5
- ActiveX Data Objects (ADO) 2.0
- ActiveX Data Objects (ADO) 2.1 SP2
- ActiveX Data Objects (ADO) 2.5
- ActiveX Data Objects (ADO) 2.6
- ActiveX Data Objects (ADO) 2.7
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q167957 SUMMARY
When ActiveX Data Objects (ADO) encounter an error, often the Errors
Collection is filled with details on the cause of the error. This article
provides sample code for extracting the maximum possible information on any
errors raised by ADO using Visual Basic.
If ADO itself encounters an error, it does not populate the Errors
Collection, but instead you have to use a native error mechanism to catch
and display the error, in this case the Visual Basic Err object. If the provider or underlying components generate error, then these will be populated in the ADO Errors Collection. So you need to check both the Visual Basic Error object and the ADO Errors Collection. However, you may want to preserve the values of the Err collection, because if you Error handling is too complex, in the process of examining and displaying the Errors collection, you could end up resetting the Err object.
REFERENCES
For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
168335
INFO: Using ActiveX Data Objects (ADO) via Visual Basic
168354 INFO: Underlying OLE and OLEDB Provider Errors Are Exposed Through ADO
Modification Type: | Minor | Last Reviewed: | 3/2/2005 |
---|
Keywords: | kberrmsg kbinfo KB167957 |
---|
|