PLC API pCmdAddr : Pointer to the executed SELECT command. nStartIndex : Gives the index of the first data record that is to be read. nRecordCount : Gives the count of data records that are to be read. cbRecordArraySize : Provides the size of an arraystructure in bytes. pDestAddr : Provides the address of the arraystructure into which the data records are to be written. bExecute : The command is executed with the rising edge. tTimeout : States the time before the function is cancelled. VAR_OUTPUT VAR_OUTPUT bBusy : BOOL; bError : BOOL; nErrID : UDINT; sSQLState : ST_DBSQLError; nRecords : 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 [ } 132] or the TcDatabaseSrv_Error_Codes [ } 135] when the bError output is set. sSQLState : Supplies the SQL error code [ } 89] of the specified database type. nRecords : Returns the number of data records. Example in ST: Because the table out of which a data record is to be read has the following structure... ... a PLC structure must be created having a comparable structure. TYPE ST_Record : STRUCT ID : T_ULARGE_INTEGER; Timestamp : DT; Name : STRING(80); VALUE :
LREAL; END_STRUCT END_TYPE To get the data type T_ULARGE_INTEGER, you have to add the library TcUtilities.lib to the PLC-Program For ARM - processors the order of the data types is different and you have to add a "Dummy-BYTE" to the struct because of the different byte alignment at ARM - processors. TYPE ST_Record : STRUCT ID : T_ULARGE_INTEGER; Timestamp : DT; Value : LREAL; Name : STRING(80); Dummy : BYTE; END_STRUCT END_TYPE TS6420 77 Version: 1.2 Column name Data type ID bigint Timestamp datetime Name nvarchar(80 Value float