SQLSetConnection Function | |
Return and optionally change the default SQL connection.
Namespace:
XSharp_VOSQLClasses
Assembly:
XSharp.VOSQLClasses (in XSharp.VOSQLClasses.dll) Version: 2.19
Syntax FUNCTION SQLSetConnection(
oSQLConnection
) AS SQLConnection CLIPPER
[ClipperCallingConventionAttribute(new string[] { ... })]
public static SQLConnection SQLSetConnection(
Usual oSQLConnection = default
)
Request Example
View SourceParameters
- oSQLConnection (Optional)
- Type: Usual
The default SQL connection that will be used by any function or class that requires a connection.
Return Value
Type:
SQLConnection
If
oSQLConnection is not specified, SQLSetConnection() returns the current setting.
If
oSQLConnection is specified, the new setting is returned.
Remarks
If oSQLConnection is not specified and there is no previous or default connection, SQLSetConnection() calls SQLOpenConnection(), sets that connection as the default, and returns it.
Examples
The following example tests connection utility functions:
1FUNCTION TestConnect()
2LOCAL wCount AS DWORD
3LOCAL aSources AS ARRAY
4LOCAL oConn AS SQLConnection
5
6aSources := SQLGetDataSources()
7
8? "ODBC Sources..."
9for wCount := 1 to ALen(aSources)
10? aSources[wCount]
11next
12
13oConn := SQLOpenConnection()
14
15SQLSetConnection(oConn)
16
17oConn:Disconnect()
See Also