GetStatus Method for LCSession

This method retrieves the current status value of a session.

Defined In

LCSession

Syntax

Call thisSession. GetStatus (statusText, externalCode, externalText)

Parameters

Value

Description

statusText

String, output, optional. Connector status message.

externalCode

Long, output, optional. Any external error codes. Long.

externalText

String, output, optional. Any external message text associated with an external code.

Example

Option Public
Uselsx "*lsxlc" 
Sub Initialize
  On Error Goto handler
  Dim session As New LCSession
  Dim src As New LCConnection ("db2") 
  src.Database = "Gold"
  src.UserID = "JDoe"
  REM deliberate bad password
  src.Password = "xyzzy"
  src.Connect
  Print "Connected to DB2."
  End
handler:
  If (session.Status <> LCSUCCESS) Then
    Dim text As String
    Dim extcode As Long
    Dim exttext As String
    Call session.GetStatus (text,  extcode, exttext)
    If (session.Status = LCFAIL_EXTERNAL) Then
      Print "DB2 message: " & exttext & "  code #" & Cstr(extcode)
    Else
      Print "Connector message: " & text
    End If
  Else
    Print Error$
  End If
  End
End Sub

Example Output

DB2 message: [IBM][CLI Driver] SQL1403N The username and/or password supplied is incorrect. SQLSTATE=08004 code #-1403