Specifies settings for an active connection. You can use SQLSETPROP(В ) to specify settings at the connection level. To specify Visual FoxPro default settings at the environment level, include 0 as the statement handle.
SQLSETPROP(nStatementHandle, cSetting [, eExpression])
- Specifies the statement handle to the data source returned by SQLCONNECT(В ).
Specifies the setting. The following table lists the values for cSetting.
Specifies whether result sets are returned synchronously (False (.F.), the default), or asynchronously (True (.T.)). Read/write.
Specifies whether SQLEXEC(В ) returns result sets all at once (True (.T.), the default), or individually with SQLMORERESULTS(В ) (False (.F.)). Read/write.
Contains True (.T.) if a shared connection is busy; otherwise contains False (.F.). Read-only.
The login connection string. Read-only.
Specifies the time to wait (in seconds) before returning a connection time-out error. If you specify 0, the wait is indefinite and a time-out error is never returned. ConnectTimeOut can be 0 to 600. The default is 15. Read/write.
The name of the data source as defined in the ODBC.INI file. Read/write.
Specifies if a pending transaction is committed or rolled back when SQLDISCONNECT(В ) is called for the last connection handle.
The default is false (.F.), indicating that a pending transaction is committed when SQLDISCONNECT(В ) is called for the last connection handle.
Specify true (.T.) to roll back a pending transaction when SQLDISCONNECT(В ) is called for the last connection handle.
Connections with automatic transaction processing are not affected by this setting.
Contains a numeric value that determines when the ODBC Login dialog box is displayed. DispLogin may assume the following values:
1 or DB_PROMPTCOMPLETE (from FOXPRO.H).1 is the default.
2 or DB_PROMPTALWAYS (from FOXPRO.H).
3 or DB_PROMPTNEVER (from FOXPRO.H).
If 1 or DB_PROMPTCOMPLETE is specified, Visual FoxPro displays the ODBC Login dialog box only if any required information is missing.
If 2 or DB_PROMPTALWAYS is specified, the ODBC Login dialog box is always displayed, making it possible for you to change settings before connecting.
If 3 or DB_PROMPTNEVER is specified, the ODBC Login dialog box isn't displayed and Visual FoxPro generates an error if the required login information isn't available. Read/write.
Specifies if error messages are displayed (True (.T.)) or are not displayed (False (.F.), the default). Read/write.
The idle timeout interval in minutes. Active connections are deactivated after the specified time interval. The default value is 0 (wait indefinitely). Read/write.
The internal ODBC connection handle, which may be used by external library files (FLL files) to call ODBC. Read-only.
The internal ODBC statement handle, which may be used by external library files (FLL files) to call ODBC. Read-only.
The size of the network packet used by the connection. Adjusting this value can improve performance. The default value is 4096 bytes (4K). Read/write
The connection password. Read-only.
Specifies the time to wait (in seconds) before returning a general time-out error. If you specify 0 (the default), the wait is indefinite and a time-out error is never returned. QueryTimeOut can be 0 to 600. Read/write.
Specifies whether the underlying connection is a shared connection (True (.T.)), or not (False (.F.)).
Contains a numeric value that determines how the connection manages transactions on the remote table. Transactions may assume the following values:
1 or DB_TRANSAUTO (from FOXPRO.H).1 is the default. Transaction processing for the remote table is automatically handled.
The user identification. Read-only.
The amount of time in milliseconds that elapses before Visual FoxPro checks if the SQL statement has completed executing. The default is 100 milliseconds. Read/write.
- Specifies the value for the setting you designate with cSetting. If you omit eExpression, the default value is restored for the setting.
Numeric data type. SQLSETPROP(В ) returns 1 if it is successful. Otherwise, it returns вЂ“ 1 if a connection level error occurs or вЂ“ 2 if an environment level error occurs.
You can use SQLGETPROP(В ) to return the current value for a specified setting.
You must disable the Open Database Connectivity (ODBC) login dialog box to support SQL pass through with Microsoft Transaction Server. To disable the ODBC login dialog box, use the statement |
The ConnectTimeOut option can be set only at the Visual FoxPro level and has no equivalent at the connection level. You can set all other options at either the connection or the Visual FoxPro level. Each option set at the Visual FoxPro level serves as a default value for subsequent connections.
The following example shows how SQLSETPROP(В ) is used to set the packet size for the current connection. SQLCONNECT(В ) displays the Select Connection or Data Source Dialog Box for you to choose a connection, and the connection is tested. The packet size is set; the setting is tested; and the results are displayed.
CLOSE ALL CLEAR ALL CLEAR nHandle=SQLCONNECT() IF nHandle > 0 nSet=SQLSETPROP(nHandle, "PacketSize", 2048 ) IF nSet > 0 =MESSAGEBOX("PacketSize was set to 2048",0,"Connection Results") ELSE =MESSAGEBOX("Error setting PacketSize",0,"Connection Results") ENDIF ELSE =MESSAGEBOX("No Connection",0,"Connection Results") ENDIF =SQLDISCONNECT(nHandle)