OPC_CONNECT

Syntax

Example

Description/Remarks

OPC_CONNECT server_number,
CLSID,
Computer name

OPC_CONNECT 1,
"{6E617103-FF2D-11D2-8087-00105AA8F840}", ""

 

See OPC Server Support for a sample template showing how the OPC commands work together.

Note: You must have initialized at least one column using the OPC_INIT command before connecting to an OPC Server. Typically all columns are initialized before the OPC_CONNECT command is used.

Returns a 1 if successful. Returns -995 if a blank CLSID was given. Returns -994 if it is already connected. Returns -993 if a COM error occurs (an error message will pop up with additional information). Returns -992 if no items set up or invalid server number

This command connects to an OPC Server.

Server_number is an integer from 1 to 10. You may connect to multiple OPC Servers simultaneously. Simply use a different server_number for each server.

The CLSID is a string which consists of many numbers and letters. Use the OPC Server Browser utility on the Designer OPC Server menu to determine the CLSID. The CLSID is also known as a GUID. Some sample GUIDs are listed in the OPC Server Support topic. If you are running on the local PC, you may use the ProgID instead of the CLSID. If you are accessing a remote computer, you should always use the CLSID.

Use a blank string if the PC is local, i.e. you are running SPC on the same computer as the OPC Server. You may use the IP address of the computer instead of its name, e.g. use 193.167.4.3 instead of NTServer09.

See MYSVAR and DE_OPT for information about potential popup error messages.