Version: 7.0.0

SQLError ​

Function ​

Obtains error and warning information.

Prototype ​

c
SQLRETURN  SQLError(SQLHENV       EnvironmentHandle, 
                    SQLHDBC       ConnectionHandle,
                    SQLHSTMT      StatementHandle, 
                    SQLCHAR       *Sqlstate,
                    SQLINTEGER    *NativeError, 
                    SQLCHAR       *MessageText,
                    SQLSMALLINT   BufferLength, 
                    SQLSMALLINT   *TextLength);

Parameters ​

Table 1 SQLError parameters

Keyword

Parameter Description

EnvironmentHandle

Environment handle, obtained through SQLAllocHandle.

ConnectionHandle

Connection handle, obtained through SQLAllocHandle.

StatementHandle

Statement handle, obtained through SQLAllocHandle.

Sqlstate

Pointer to the buffer that receives the SQLSTATE string.

NativeError

Pointer to the buffer that receives the native error code of the data source.

MessageText

Pointer to the buffer that receives the error message text.

BufferLength

Maximum length of the error message buffer, in bytes.

TextLength

Pointer to the buffer, which is used to return the total number of bytes available in MessageText.

Return Values ​

  • SQL_SUCCESS: The call is successful.

  • SQL_SUCCESS_WITH_INFO: Some warning information is present.

  • SQL_ERROR: Error information failed to be obtained.

  • SQL_INVALID_HANDLE: The input handle is invalid.

  • SQL_NO_DATA: No error information is available.

Example ​

See: Example