Siebel VB Language Reference > VB Language Reference >
SQLError Function
This custom VB function can be used to retrieve detailed information about errors that might have occurred when making an ODBC function call. It returns errors for the last ODBC function and the last connection. NOTE: Siebel VB SQLxxxx functions are supported for non-Unicode databases only.
Syntax
SQLError(destination())
|
|
destination |
A two-dimensional array of type variant, in which each row contains one error |
Returns
Not applicable Usage
Detailed information for each detected error is returned to the caller in the destination array. Each row of the destination array is filled with information for one error. The elements of each row are filled with the following data:
Element 1: |
A character string indicating the ODBC error class/subclass |
Element 2: |
A numeric value indicating the data source native error code |
Element 3: |
A text message describing the error |
Note that information for more than one error may be returned in the destination array. A 0 in the first element of a row indicates the end of error information in the destination array. If there are no errors from a previous ODBC function call, then a 0 is returned in the caller's array at (1,1). If the array is not two dimensional or does not provide for the return of the preceding three elements, then an error message is returned in the caller's array at (1,1). CAUTION: This function, as well as the other SQL functions available in Siebel VB, should not be used to query the underlying database. Use the Siebel Object Interfaces to query Siebel data. Use the SQL functions only to query non-Siebel data.
Example
This example forces an error to test the SQLError function. 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 select 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
Related Topics
SQLClose Function SQLExecQuery Function SQLGetSchema Function SQLOpen Function SQLRequest Function SQLRetrieve Function SQLRetrieveToFile Function
|