ADO - Error

An Error object contains information about a single error or warning from an OLEDB provider. Error objects are contained within a 0-based Errors collection which is referenced from a Connection object.

Properties

  • ADO.Properties.Description
  • ADO.Properties.HelpContext
  • ADO.Properties.HelpFile
  • ADO.Properties.NativeLink
  • ADO.Properties.Number
  • ADO.Properties.Source
  • ADO.Properties.SQLState

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
dim aCN as adodb.Connection

on error goto err_trap
set aCN = new adodb.Connection

aCN.connect
exit sub

err_Trap:
' an error was triggered
debug.print aCN.Errors.Count & " errors triggered"
debug.print aCN.Errors(0).Description
exit sub

Hmm… This is a very old example. These days (and for many days now ;^), I would use a try/catch block