Siebel VB Language Reference > Methods Reference for Siebel VB > ODBC Methods >

ODBC Get Errors Method


The ODBC Get Errors method is a Siebel VB method that gets detailed information about errors that occur during an ODBC method call. It returns errors for the last ODBC method and the last connection.

Format

SQLError(destination())

The following table describes the arguments that you can use with this method.

Argument
Description

destination

A two-dimensional array of type variant, where each row contains one error.

Usage

The ODBC Get Errors method returns detailed information for each detected error to the caller in the destination array. It fills each row of the destination array with information for one error. The following table describes how it fills elements of each row with data.

Element
Description

1

A character string that identifies the ODBC error class and subclass.

The ODBC Get Errors method might return information for more than one error in the destination array. A 0 (zero) in the first element of a row identifies the end of error information in the destination array.

2

A numeric value that identifies the native error code of the data source.

3

A text message that describes the error.

If no errors from a previous ODBC method call are present, then it returns a 0 (zero) in the array at the first element of the first row. If the array is not two dimensional or if it does not provide for the return of the preceding three elements, then it returns an error message in the array at the first element of the first row.

Example

The following example forces an error as a way to test the ODBC Get Errors method:

Sub Button_Click
' Declarations
   Dim connection As long
   Dim prompt as integer
   Dim retcode as long
   Dim errors(1 To 10, 1 To 3) as Variant

   ' Open the data source
   connection = SQLOpen("DSN = SVBTESTW;UID=DBA;PWD=SQL"
,outputStr, prompt: = 3)

   ' force an error to test SQLError choose a nonexistent table
   retcode = SQLExecQuery(connection: = connection, query: = "select * from notable ")

   ' Retrieve the detailed error message information into the
   ' errors array
   SQLError destination: = errors
   errCounter = 1
   while errors(errCounter,1) <>0
      errCounter = errCounter + 1
   wend

      retcode = SQLClose(connection)

end sub

Siebel VB Language Reference Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Legal Notices.