Add and configure an OLE-DB variable
- Last UpdatedFeb 24, 2025
- 2 minute read
An OLE DB variable stores an SQL select query statement that queries the database to obtain the value for the variable.
OLE-DB variables have the following characteristics:
-
AVEVA™ Production Management updates the value of the running OleDbVariable item every time the OleDbDataSource item polls the OLE DB provider as determined by the PollInterval property setting of the OleDbDataSource item and the database connection settings of the OleDbConnection item.
-
Each OleDbVariable item represents an SQL dialect of the queried database. Add a separate OleDbVariable item for each SQL query of the OLE DB database connection you want to use. You can add multiple OleDbVariable items per OleDbDataSource item, one for each SQL query.
-
Design the OleDbVariable SQL query so that the result is a scalar (single) value. Record sets and arrays are not valid return result values. If you specify a query that returns a table, the query returns only the first-row first-column value.
-
If you do not want to poll the OLE DB provider, that is you want to manually trigger the data request, or you want to return a dataset that contains one or more data tables, use an OleDbAdapter item instead of an OleDbVariable item. OleDbAdapter items are manually triggered and return a dataset that contains one or more data tables.
Prerequisite
Add and configure an OLE-DB data source.
To add an OLE-DB variable
-
In the Project Explorer, right-click the data source, point to Add Item, point to OLE DB Connector, and then click Variable. An OleDbVariable item appears.

-
Rename the item with a meaningful name.
-
Configure the properties. For guidance in configuring the properties, see OLE-DB variable properties.