共用方式為


SQLGETPROP( ) Function

Returns current or default settings for an active connection.

SQLGETPROP(nConnectionHandle, cSetting)

Return Values

Character, Numeric, or Logical

Parameters

  • nConnectionHandle
    Specifies the connection handle to the data source returned by SQLCONNECT( ). If you specify 0 for nConnectionHandle, SQLGETPROP( ) returns the environment setting.
  • cSetting
    Specifies the setting. See SQLSETPROP( ) for a list of the settings you can specify.

Remarks

If a connection level error occurs, – 1 is returned. If an environment level error occurs, – 2 is returned.

Example

The following example uses SQLCONNECT( ) to display the connection dialog box. Choose a datasource and the example will display the results using SQLGETPROP( ) with the DataSource cSetting.

* Clear environment
CLOSE ALL
CLEAR ALL
CLEAR

* Display the Select Connection or Data Source dialog box
* to choose a connection
nHandle=SQLCONNECT()

* Test connection, report results
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( )