FB_DBCreate

FB_DBCreate 1:

The FB_DBCreate function block allows databases to be created. MS SQL databases, MS SQL Compact databases, MS Access databases and XML databases can be created with this FB.

ASCII files can (but do not have to) be created with the function block FB_DBCreate. If they do not exist, they are created automatically during the first write access. They only have to be declared in the XML configuration file.

It is not possible to create DB2, Oracle, MySQL, PostgreSQL, InterBase and Firebird databases. In addition, it is not possible to overwrite existing databases. In this case the function block FB_DBCreate would return an error.

VAR_INPUT

VAR_INPUT
    sNetID      : T_AmsNetID;
    sPathName   : T_MaxString;
    sDBName     : T_MaxString;
    eDBType     : E_DBTypes;
    sSystemDB   : T_MaxString;
    sUserId     : T_MaxString;
    sPassword   : T_MaxString;
    bExecute    : BOOL;
    tTimeout    : TIME;
END_VAR

sNetID              : Is a string containing the AMS network identifier of the target device to which the ADS command is directed.

sPathName    : Gives the path to the database.

sDBName       : Gives the name of the database that is to be created.

eDBType         : Gives the type of the database that is to be created.

sSystemDB    : Only at "Access Databases". Contains the path to the MDW-file.

sUserId           : Indicates the username for the registration.

sPassword    : Contains the password.

bExecute        : The command is executed with the rising edge.

tTimeout         : Indicates the duration of the timeout.

VAR_OUTPUT

VAR_OUTPUT
    bBusy       : BOOL;
    bError      : BOOL;
    nErrID      : UDINT;
END_VAR

bBusy          : The command is in the process of being transmitted by ADS. No new command will be accepted if "bBusy" remains TRUE.

bError          : Becomes TRUE, as soon as an error occurs.

nErrID          : Supplies the ADS Error Code when the bError output is set.

FB_DBCreate 2:

If the newly created databases are to be used by the TwinCAT Database Server, the connection data have to be written to the XML configuration file with the aid of the function block FB_DBConnectionADD.

Requirements

Development environment

Target system type

PLC libraries to be linked

TwinCAT v2.10.0

PC or CX (x86)

TcDatabase.Lib

TwinCAT v2.10.0

CX (ARM)