Click or drag to resize

SqlSetProp Function (Long, Long, Usual)

X#
Specifies settings for an active connection. You can use SqlSetProp( ) to specify settings at the connection level. To specify application default settings at the environment level, include 0 as the statement handle.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax
 FUNCTION SqlSetProp(
	nStatementHandle AS LONG,
	nSetting AS LONG,
	eExpression AS USUAL
) AS LONG
Request Example View Source

Parameters

nStatementHandle
Type: Long
Specifies the statement handle to the data source returned by SqlConnect( ).
nSetting
Type: Long
Specifies the setting. For a list of the settings you can specify see the SQLProperty Enum.
eExpression
Type: Usual
Specifies the value for the setting you designate with cSetting. If you omit eExpression, the default value is restored for the setting.

Return Value

Type: Long
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.
Remarks
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 codeSqlSetProp(cStatementHandle, 'DispLogin', 3)/code, where cStatementHandle is the statement handle returned by SqlConnect( ). You can also disable the ODBC login dialog box in the Connection Designer.
The ConnectTimeOut option can be set only at the application level and has no equivalent at the connection level. You can set all other options at either the connection or the application level. Each option set at the application level serves as a default value for subsequent connections.
SettingDescriptionRead/Write
AsynchronousSpecifies whether result sets are returned synchronously (False (.F.), the default), or asynchronously (True (.T.)). Read/write
BatchMode Specifies whether SqlExec( ) returns result sets all at once (True (.T.), the default), or individually with SqlMoreResults( ) (False (.F.)). Read/write
ConnectBusyContains True (.T.) if a shared connection is busy; otherwise contains False (.F.).Read-only
ConnectStringThe login connection string.Read-only
ConnectTimeOut 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
DataSourceThe name of the data source as defined in the ODBC.INI file for ODBC connections. Read/write
DisconnectRollback 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.
Read/write
DispLogin 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, X# 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 X# generates an error if the required login information isn't available. Read/write.
Read/write
DispWarningsSpecifies if error messages are displayed (True (.T.)) or are not displayed (False (.F.), the default). Read/write
IdleTimeout The idle timeout interval in minutes. Active connections are deactivated after the specified time interval. The default value is 0 (wait indefinitely). Read/write
ODBChdbcThe internal Ado.Net DbConnection object.Read-only
ODBChstmtThe internal Ado.Net DbCommand object.Read-only
PacketSize The size of the network packet used by the connection. Adjusting this value can improve performance. The default value is 4096 bytes (4K).
Changing this property does not work for all providers.
Read/write
PasswordThe connection password. When you create a connection with the Login dialog then this password is not always available.Read-only
QueryTimeOut 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
SharedSpecifies whether the underlying connection is a shared connection (True (.T.)), or not (False (.F.)).Read-only
Transactions 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.
2 or DB_TRANSMANUAL (from Foxpro.H). Transaction processing is handled manually through SqlCommit( ) and SqlRollBack( ).
Read/write
UserIdThe user identification. When you create a connection with the Login dialog then this UserId is not always available.Read-only
WaitTime The amount of time in milliseconds that elapses before X# checks if the SQL statement has completed executing. The default is 100 milliseconds. Read/write
Examples
X#
 1Close ALL
 2Clear ALL
 3Clear
 4nHandle=SqlConnect()
 5IF nHandle > 0
 6nSet=SqlSetProp(nHandle, "PacketSize", 2048 )
 7IF nSet > 0
 8=MessageBox("PacketSize was set to 2048",0,"Connection Results")
 9ELSE
10=MessageBox("Error setting PacketSize",0,"Connection Results")
11ENDIF
12ELSE
13=MessageBox("No Connection",0,"Connection Results")
14ENDIF
15=SqlDisconnect(nHandle)
See Also