version 2003 (Modified)
OP Select 4D Server (netCompID; serverName; serverID; otherButton) Longint
Parameter | Type | Description | |
netCompID | Longint | Network component reference number (always 2) | |
serverName | Text | Selected server name | |
serverID | Longint | Unique ID for selected server | |
otherButton | Boolean | To show or hide the "Other" button | |
Function result | Longint | Error code result for the function |
Description
OP Select 4D Server allows you to graphically choose a 4D Server from the Connect to Data Server dialog box.
Pass 2 in netCompID. Starting from version 2003 of 4D Open for 4D, only the TCP/IP network component (reference number = 2) can be used.
The server name is returned in serverName. This name can be saved somewhere in the database to be later passed to OP Find 4D Server. serverName is equal to the IP address followed by a colon and the name of the database. For example, the following would be returned for a Customers DB database with the IP address 195.4.210.25:
"195.4.210.25:Customers DB".
The server reference number is returned in serverID. This reference number is then passed to OP Open connection to open a connection to the selected database.
Error Codes
If OP Select 4D Server executes successfully, it returns 0. Otherwise, this function returns one of the following errors:
Error Code | Description |
-108 | Not enough memory to perform this operation. |
-10020 | No server was selected while using OP Select 4D Server, |
(the Cancel button was clicked). | |
2 | The Other button was clicked while using OP Select 4D Server. |
10128 | The 4D Open for 4th Dimension package has not been initialized. |
10129 | The network component was not found. |
10131 | The network component has not been initialized. |
10154 | This command cannot be executed right now. |
Example
The following method allows you to choose a database from the list and open a connection to it.
C_STRING(255;$Server) C_LONGINT($ErrCode;$ServerID) $ErrCode:=OP Select 4D Server (2;$Server;$ServerID)