Read and Modify Data from the Database

Overview

The program SR_SqlRemoteAccess implements a statemachine that controls an instance of the function block FB_SqlDbRequest of the SqlRemoteAccess library.

It supports the following functions:

  • Establishing a connection to the SQL Gateway.

  • Sending SQL requests for:

    • Retrieving data from the database.

    • Modifying data on the database.

Read Data from the Database

For control and monitoring the read access, the visualization screen Visu_SqlRead is provided in the project example.

In this application example, two preformed SQL requests are created and can be selected by the associated buttons on the visualization. The concatenation of the selected SQL request is implemented in the sub routines A_QuerySelect1 or A_QuerySelect2.

Modify Data on the Database

For control and monitoring the write access, the visualization screen Visu_SqlWrite is provided in the project example.

In this application example, three preformed SQL requests are created and can be selected by the associated buttons on the visualization. The concatenation of the selected SQL request is implemented in the sub routines A_QueryInsert, A_QueryUpdate, or A_QueryDelete.

Handle Product Data

The program SR_ProductData is intended to process the data exchanged with the database. In this application example, this program implements the reading and conversion of the controllers real time clock.

Program Code SR_Visu

The program SR_Visu implements additional functions to control the visualization output.