ONE Active Server Pages Product Home Page Developer Site Version


ADO Error Object Description Property

A descriptive string associated with an Error object. This property is not currently supported on UNIX.

Description Property Return Values (ADO Error Object)

Returns a String value.

Description Property Remarks (ADO Error Object)

Use the Description property to obtain a short description of the error. Display this property to alert the user to an error that you cannot or do not want to handle. The string will come from either ADO or a provider.

Providers are responsible for passing specific error text to ADO. ADO adds an Error object to the ADO Errors Collection for each provider error or warning it receives. Enumerate the Errors collection to trace the errors that the provider passes.

Description Property Example (ADO Error Object)

This Visual Basic example triggers an error, traps it, and displays the ADO Error Object Description Property, ADO Error Object HelpContext, HelpFile Property, ADO Error Object NativeError Property, ADO Error Object Number Property, ADO Error Object Source Property, and ADO Error Object SQLState Property properties of the resulting Error object:

Public Sub DescriptionX() 
Dim cnn1 As ADODB.Connection 
Dim errLoop As ADODB.Error 
Dim strError As String
On Error GoTo ErrorHandler 
` Intentionally trigger an error. 
Set cnn1 = New ADODB.Connection 
cnn1.Open "nothing" 
Exit Sub
` Enumerate Errors collection and display 
` properties of each Error object. 
For Each errLoop In cnn1.Errors 
strError = "Error #" & errLoop.Number & vbCr & _ 
" " & errLoop.Description & vbCr & _ 
" (Source: " & errLoop.Source & ")" & vbCr & _ 
" (SQL State: " & errLoop.SQLState & ")" & vbCr & _ 
" (NativeError: " & errLoop.NativeError & ")" & vbCr 
If errLoop.HelpFile = "" Then 
strError = strError & _ 
" No Help file available" & _ 
vbCr & vbCr 
strError = strError & _ 
" (HelpFile: " & errLoop.HelpFile & ")" & vbCr & _ 
" (HelpContext: " & errLoop.HelpContext & ")" & _ 
vbCr & vbCr 
End If
Debug.Print strError 
Resume Next 
End Sub