ExecuteDataReturn
This method sends the call of the specified stored procedure to the database via the database connection already opened by the function block FB_SQLDatabase. An instance of the FB_SQLResult function block can be transferred for reading the returned records.
Syntax
METHOD ExecuteDataReturn : BOOL
VAR_INPUT
pParameterStrc: POINTER TO BYTE;
cbParameterStrc: UDINT;
pSQLDBResult: POINTER TO FB_SQLDBResultEvt;
END_VAR
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 |
pSQLDBResult | POINTER TO FB_SQLDBResultEvt | Returns a new instance of the function block FB_SQLDBResultEvt. |
Return value
Name | Type | Description |
---|---|---|
Read | 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.ExecuteDataReturn(pParameterStrc := ADR(Customer_ID), cbParameterStrc:= SIZEOF(Customer_ID), pSQLDBResult := ADR(fbSqlResult)) THEN
IF fbSQLStoredProcedure.bError THEN
tcMessage := fbSQLStoredProcedure.ipTcResult;
nState := 255;
ELSE
nState := nState+1;
END_IF
END_IF
FB_SQLResultEvt can then be used to read the data.