FB_SQLCommand

FB_SQLCommand 1:

Function block for executing SQL commands. Before it can be used it has to be initialized with the function block FB_SQLDatabase.

Syntax

Definition:

FUNCTION BLOCK FB_SQLCommand
VAR_INPUT
    sNetID: T_AmsNetID := '';
    tTimeout: TIME := T#5S;
END_VAR
VAR_OUTPUT
    bBusy: BOOL;
    bError: BOOL;
    ipTcResultEvent: Tc3_EventLogger.I_TcResultEvent;
END_VAR

FB_SQLCommand 2: Inputs

Name

Type

Description

sNetID

T_AmsNetID

AMS network ID of the target device at which the ADS command is directed.

tTimeout

TIME

Indicates the time before the function is cancelled.

FB_SQLCommand 3: Outputs

Name

Type

Description

bBusy

BOOL

TRUE as soon as a method of the function block is active.

bError

BOOL

TRUE when an error occurs.

ipTcResultEvent

Tc3_EventLogger.I_TcResultEvent

Result interface with detailed information on the return value.

FB_SQLCommand 4: Methods

Name

Definition location

Description

Execute

Local

Sends the specified SQL command to the database via the database connection already opened by the function block FB_SQLDatabase.

ExecuteDataReturn

Local

Sends the specified SQL command to the database via the database connection already opened by the function block FB_SQLDatabase.

An instance of the function block FB_SQLResult can be transferred for reading the returned records.

Requirements

Development environment

Target platform

PLC libraries to be linked

TwinCAT v3.1 Build 4020.10

PC or CX (x86)

Tc3_Database