Click or drag to resize

SQLGetMyConnection Function

X#
Connect to the ODBC source specified.

Namespace:  VOSQLClasses
Assembly:  VOSQLClasses (in VOSQLClasses.dll) Version: 2.21
Syntax
 FUNCTION SQLGetMyConnection(
	cMySourceName,
	cMyUserID,
	cMyPassword
) AS USUAL CLIPPER
Request Example View Source

Parameters

cMySourceName (Optional)
Type: Usual
The source to connect to.
cMyUserID (Optional)
Type: Usual
The user ID that will be used to connect to the source.
cMyPassword (Optional)
Type: Usual
The password that will be used to connect to the source.

Return Value

Type: Usual
If a connection to the source is found, it is returned as an SQLConnection object. If a connection is not found, one is created and returned as an object.
Remarks
SQLGetMyConnection is used in the code generated from the SQL editor. It allows a connection to be shared among multiple servers in the same task.
Examples
The following example connects to WATCOM; then ends the connection:
X#
1FUNCTION TestConnect()
2LOCAL oConn AS SQLConnection
3oConn := SQLGetMyConnection("sample", "dba", "sql")
4? "SRC=",oConn:DataSource
5? "UID=",oConn:UserID
6? "PWD=",oConn:Password
7SQLDropMyConnection("sample", "dba", "sql")
See Also