Demo application: Reading data from an SQL database via VBScript driver.

This article uses a demo application to illustrate how to read data from an SQL database via VBScript driver, by Elipse Software.

Introduction

Sometimes, you will need your Elipse application to read the data from a database periodically, as if it were an I/O driver; in these cases, we recommend using Elipse Software’s VBScript driver. Consequently, when you create a script to read this data directly from the VBScript driver (IOServer.exe), the script will keep synchronous operations (GetADORecordSet) from influencing the main thread of E3/Power (E3Run.exe).

Demo application

In the demo application below, we illustrate how to read data from a Microsoft SQL database via VBScript driver. In the example:

  • the reading takes place periodically, and
  • read values are attributed to the I/O driver’s IOTags.

Setting up and using the application to read data from an SQL database via VBScript driver

To make sure the application works properly, you must set up the connection parameters with the database; as a result, you will be able to communicate with the SQL database.

The object seen in the figure below is the database:

Then, the next figure shows the SQLRead driver script:

The application has an IOTag called ReadStatus, which returns the status of the last read. The possible values for this tag are:

  • ReadStatus = 0 (Successful read!)
  • ReadStatus = 1 (Failed read!)

Additionally, you can also set up a read scan period via an IOTag field called ReadPeriod.

Attachments:

AppExemploReadSQL.zip

Este artigo foi útil? Was this post helpful?
Yes0
No0

Leave a Reply

Your email address will not be published.Required fields are marked *