SQLGetProp(), SQLSetProp()
These two functions let you check and change properties of a remote connection. Unlike the other functions whose names begin with SQL, these apply both to views and to SQL Pass-Through, though some properties are relevant really for only one or the other.
Usage |
uResult = SQLGetProp( nConnectionHandle, cProperty ) nSuccess = SQLSetProp( nConnectionHandle, cProperty [, uValue ] ) |
Parameter |
Value |
Meaning |
nConnectionHandle |
Positive Integer |
Check or change properties for an existing connection with this handle. |
0 |
Check or change default properties used for creation of new connections. |
|
cProperty |
Character—See list in Help |
The property whose value is to be checked or changed. |
uValue |
The type indicated by cProperty |
The new value to assign to cProperty. |
Omitted |
See below for further discussion. In theory, omitting this value resets the property to its default. |
|
uResult |
Character, Numeric or Logical |
The current value of cProperty for the specified connection. |
nSuccess |
1 |
Change was successful. |
Negative value |
An error occurred. |
In VFP 3, the optional third parameter in SQLSetProp() is a real hit-or-miss proposition. Sometimes when you omit it, things work as documented—the specified property gets restored to its default value. For WaitTime and BatchMode, the property changes, but the value it changes to is not the documented default. (WaitTime goes to 0; BatchMode goes to .F.) In the worst cases, you get an error message telling you "Property value is out of bounds"—we see this for Transactions and DispLogin. In Visual FoxPro 5 and later, these problems are fixed. |
Example |
nHandle = SQLConnect("Northwinds") ? SQLGetProp(nHandle,"Asynchronous")&& Displays .F., the default * Make it asynchronous ? SETSetProp(nHandle,"Asynchronous",.T.) |
See Also |
Create Connection, CursorGetProp(), CursorSetProp(), DBGetProp(), DBSetProp(), SQLConnect() |