Connect

This method opens a connection to a declared database.

Syntax

METHOD Connect : BOOL
VAR_INPUT
    hDBID: UDINT := 1;
END_VAR

Connect 1: Inputs

Name

Type

Description

hDBID

UDINT

Indicates the ID of the database to be used.

Connect 2: Return value

Name

Type

Description

Connect

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

VAR
    fbSqlDatabase : FB_SQLDatabaseEvt(sNetID := '', tTimeout := T#5S);
END_VAR
// open connection
IF fbSqlDatabase.Connect(1) THEN
    IF fbSqlDatabase.bError THEN
        nState := 255; 
    ELSE
        nState := nState+1; 
    END_IF
END_IF