SQLGETPROP( ) Function

Retrieves the current or default settings for an active connection.

SQLGETPROP(nStatementHandle, cSetting)

Parameters

  • nStatementHandle
    Specifies the statement handle to the data source returned by SQLCONNECT( ). If you specify 0 for nStatementHandle, SQLGETPROP( ) returns the environment setting.
  • cSetting
    Specifies the setting. For a list of the settings you can specify, see SQLSETPROP( ) Function.

Return Values

Character, Numeric, or Logical data type. SQLGETPROP( ) returns the current or default settings for an active connection. SQLGETPROP( ) returns -1 if a connection level occurs and -2 if an environment level error occurs.

Example

The following example uses SQLCONNECT( ) to display the Select Connection or Data Source Dialog Box. Choose a data source, the data source connection is tested, and the example displays the results using SQLGETPROP( ) and the cSetting for the data source.

CLOSE ALL
CLEAR ALL
CLEAR
nHandle=SQLCONNECT()
IF nHandle > 0
 cSource= SQLGETPROP(nHandle, "datasource")
 =MESSAGEBOX("Current Data Source = "+cSource,0,"Connection Results")
ELSE
 =MESSAGEBOX("Connection Error = " + ;
  ALLTRIM(STR(nHandle)),0,"Connection Results")
ENDIF
=SQLDISCONNECT(nHandle)

See Also

AERROR( ) | SQLCONNECT( ) | SQLSETPROP( )