<ADODB_Connection>.Errors().Source

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Modules > ADODB > ADODB Module Classes > ADODB_Connection > ADODB_Connection Interfaces > <ADODB_Connection>.Errors >

<ADODB_Connection>.Errors().Source

 

Description

 
Returns the name of the object or application that generated the error.

 

Syntax

 

s = <ADODB_Connection>.Errors(lIndex).Source

 

Returns

 

String.

 

Parameters

 

Name

Type

Optional

Meaning

lIndex

Numeric

No

Error index from 1 to <ADODB_Connection>.Errors.Count

 

Remarks

 

Restrictions

 

See also

 

Examples

 

...

      '---To check if there is an error, always use connection and Errors.Count method

      '---In this example all errors are reported in one go using pConn.Errors.Msg

      If pConn.Errors.Count Then 

        PrintL "--> Error happened:" In %CCOLOR_FLIGHTRED

        printl pConn.Errors.Msg

        pConn.Errors.Clear

      End If

...

 

...

      '---To check if there is an error, always use connection and Errors.Count method

      '---In this example every single error is reported reading Error by Error information

      If pConn.Errors.Count Then 

        PrintL "--> Error happened:" In %CCOLOR_FLIGHTRED

 

        For nError = 1 to pConn.Errors.Count

          PrintL "Error number..:", pConn.Errors(nError).Number

          PrintL "Description...:", pConn.Errors(nError).Description

          PrintL "Source........:", pConn.Errors(nError).Source

          PrintL "SQLState......:", pConn.Errors(nError).SQLState

          PrintL "NativeError...:", pConn.Errors(nError).NativeError

        Next

        '---Clear all errors so new errors will restart to fill Errors collection

        pConn.Errors.Clear

      End If

...