OC Login

4D - Documentation   Français   English   German   4D ODBC, Command Theme List   4D ODBC, Command Alphabetical List   Back   Previous   Next

version 1.5


OC Login ({user; {; password{; dataSource}}}) Longint

ParameterTypeDescription
userStringName of user
passwordStringPassword
dataSourceStringName of data source
Function resultLongintConnection ID, or -1 if an error occurs

Description

The OC Login function logs into an ODBC server using the login parameters you specify and returns a connection ID (identifier).

user is the user name you want to use. If you do not specify user, 4D ODBC uses the name previously entered in the Connect to a data source dialog box. The user name is known only if the Save Name check box was selected in the dialog box.

password is the password for user. If you do not specify password, 4D ODBC uses the password previously entered in the Connect to a data source dialog box. password can only be used if the Save Password check box was selected in the dialog box.

dataSource specifies the data source to which you want to connect. You need to specify a data source name as defined in ODBC Setup for the specific data source driver that you wish to use. If you do not specify a Server, 4D ODBC uses the last server chosen in the Connect to a data source dialog box.

Examples

(1) The following statement logs into a Microsoft SQL Server, using the user name "mary" and the password "toto":

   Login_ID := OC Login("mary"; "toto"; "MSSQLServer") 

(2) The following statement logs in using the server, user name, and password last selected in the Connect to an ODBC Server dialog box.

   Login_ID := OC Login

OC Login returns a connection ID if the operation was successful, or -1 if there was an error.

In the previous statements, the connection ID is stored in the Login_ID variable. This variable can then be used with other 4D ODBC commands to execute statements and retrieve data and with OC LOGOUT to logout from the server.

See Also

OC Login dialog, OC LOGOUT.


4D - Documentation   Français   English   German   4D ODBC, Command Theme List   4D ODBC, Command Alphabetical List   Back   Previous   Next