ADO » Error » SQLState

long = errorobject.SQLState

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.


For Each objError in objConnection
   ErrorInfo = "Description; " & objError.Description & VBCRLF &_
      "Help Context: " & objError.HelpContext & VBCRLF &_
      "Help File: " & objError.HelpFile & VBCRLF &_
      "Native Error: " & objError.NativeError & VBCRLF &_
      "Number: " & objError.Number & VBCRLF &_
      "Source: " & objError.Source & VBCRLF &_
      "SQL State: " & objError.SQLState & VBCRLF

   Response.Write ErrorInfo

See Also: