Execute

This method sends the call of the specified stored procedure to the database via the database connection already opened by the function block FB_SQLDatabaseEvt.

Syntax

METHOD Execute : BOOL
VAR_INPUT
    pParameterStrc: POINTER TO BYTE;
    cbParameterStrc: UDINT;
END_VAR

Execute 1: Inputs

Name

Type

Description

pParameterStrc

POINTER TO BYTE

Pointer address to the parameter structure that is transferred to the procedure.

cbParameterStrc

UDINT

Length of the parameter structure.

Execute 2: Return value

Name

Type

Description

Execute

BOOL

Displays the status of the method. Returns TRUE as soon as the method execution is finished, even in the event of an error.

Sample

Uses the stored procedure previously created with FB_SQLDatabaseEvt.CreateSP().

VAR
    fbSQLStoredProcedure : FB_SQLStoredProcedureEvt(sNetID:='', tTimeout := T#5S);
    Customer_ID          : LINT;
    tcMessage            : I_TcMessage;
END_VAR
IF fbSQLStoredProcedure.Execute(pParameterStrc := ADR(Customer_ID) , cbParameterStrc:= SIZEOF(Customer_ID)) THEN
    IF fbSQLStoredProcedure.bError THEN
        tcMessage := fbSQLStoredProcedure.ipTcResult;
        nState := 255;
    ELSE
        nState := nState+1;
    END_IF
END_IF