ADODB Object
 
Syntax
 
string = errorobject.SQLState
 
Description
Returns a five character string that is the SQL error code.
The SQLState property is a string that contains the five-character SQL error code that is returned by the provider when an error occurs during the execution of an SQL command (query).
 
The SQL error codes are supposed to follow at least the minimum standards established by the "SQL Access Group." However, providers can vary greatly as to which portions of the SQL standards they recognize. You will need to consult the SQL documentation that is usually available from the provider in order to interpret the error code. Some SQL errors may not have a code and the returned value will be blank.
See Also
Example
 
Dim ErrorInfo As String
 
For Each objError in objConnection
   ErrorInfo = "Description; " & objError.Description & vbNewline & _
      "Help Context: " & objError.HelpContext & vbNewline & _
      "Help File: " & objError.HelpFile & vbNewline & _
      "Native Error: " & objError.NativeError & vbNewline & _
      "Number: " & objError.Number & vbNewline & _
      "Source: " & objError.Source & vbNewline & _
      "SQL State: " & objError.SQLState & vbNewline
 
   Debug.Print ErrorInfo
Next