The Data Control provides the interface between OLE DB data providers and the VisiconX object. Through the Data Control, you can communicate with any OLE DB data provider installed on your local machine, including, but not limited to SQL Server, MS Access, and Oracle. You can also access relational databases using OBDC drivers.
Data Control and Its Properties Dialog Box
In the run-time environment, the control itself displays the zero-based number of the current row and navigation arrows, which you can use to move through the data displayed in the Grid Control.
Data Control Display in the run-time environment
If the data provider you want to access has security implemented, the Data Control requires an authorized user ID and password before it can access and retrieve data. Users accessing a secured SQL Server have the option of using the security features of Windows.
NOTE: If the data control's InvisibleInRunMode property is set to True, security error messages will not appear.
The Data Control is easy to configure with a point-and-click user interface. The Data Control dialog box presents tabs from which you can quickly select a server and a database to access.
Provider Tab
The Provider tab provides a list of the available OLE DB data providers you can choose from. These data providers map to many different types of relational databases. Once you have selected a provider, you can proceed to the Database tab.
Database Tab
The fields on the Database tab differ depending on the data provider you select. Each type of data provider requires different information to connect to the associated databases. You must select a data provider and database before moving on to the Record Source tab.
Record Source Tab
The Record Source tab in the Data Control OLE Properties dialog box is the location where you create an SQL statement to retrieve, insert, or update data, or use a stored procedure to retrieve data. The Record Source Tab is identical for iFIX and CIMPLICITY users, with the exception of the Secure SQL Operation section for electronic signatures, which is only available to iFIX users as shown in the following figure:
Record Source Tab in the iFIX Data Control OLE Properties Dialog
In the Record Source tab, you can specify whether the SQL Wizard can be accessed during run mode. iFIX users can also specify whether electronic signatures are required for SQL statements when they are run in WorkSpace run mode.
IMPORTANT (iFIX USERS ONLY): Before you can write to a database you must have the VisiconX Writes application feature added to your user and/or group account. Also, if the data controls you created in a previous version of iFIX were performing database writes, they will no longer work; you must add the VisiconX Writes application feature to your user and/or group account. For more information, see Application Features in the Configuring Security Features e-book.
SQL Wizard
The Record Source tab is also the location where you activate the SQL Wizard, a tool that builds SQL Select, Insert, and Update statements for you. Use the SQL Wizard to quickly create simple-to-complex SQL Select statements or simple Insert or Update statements. You can create more complex Insert or Update statements in the Record Source tab. Queries can support:
- Up to 64 column properties that can be animated.
- Up to 32 query properties that serve as variables in the query statement. These properties can be set to any value or animated through the iFIX object animation dialog.
Be aware that on Record Source tab, if you choose to use a .csv file as table, then you should use a table alias instead of using the .csv file name to modify the table columns in the SQL command. For example, do not create a query like this:
SELECT data.csv.col1, data.csv.col2 FROM data.csv
Instead, create a query like this:
SELECT t.col1, t.col2 FROM data.csv t
where t is the alias of the data.csv table.
For more information about using the SQL Wizard, see Creating a Query Using the SQL Wizard and Creating an Insert or Update Statement.