To connect the Database Exchange ActiveX
Control to a database and view or edit data, you must first specify
a data source. This information is set in the Connection tab
of the ActiveX control's Properties dialog (accessible by
double-clicking on the control).
The Connection tab includes the following
fields:
Database Connection String
The details of the
connection between the Database Exchange ActiveX control and the
data source. This includes the location of the data source,
driver and security information, and default data source settings.
This string is built when you set up a data source, as described in
the example below.
Record Source
The type of data source you are connecting
to.
Note:The Database Exchange ActiveX Control does not support a
connection to the local Citect runtime via the Citect OLE DB
Provider.
Example
The following example illustrates how to create
and configure a new data source in order to connect to the
Recipes.DBF file in the CitectSCADA Example project.
Double-click the Database Exchange ActiveX control and
click the Connection tab on the right-hand side of the
dialog.
Click the Build button next to the Database Connection
String field. This will launch the Data Link Properties
utility.
In the Provider tab, select Microsoft OLE DB Provider
for ODBC Drivers and click Next.
In the Connection tab, click the Use Connection
String radiobutton and then click Build.
In the Select Data Source dialog, click New to
create a new DSN.
Select Microsoft dBase Driver from the Create
New Data Source dialog. Click Next and then Browse.
In the Save As dialog, enter a name for the DSN in the
File Name field and click Save.
Click Next in the Create
new Data Source dialog.
Click Finish.
In the ODBC dBASE
Setup dialog, select dBase IV from the Version drop-down
box and uncheck Use Current Directory.
Click Select Directory and browse to your Citect
Example folder (Citect\User\Example).
Click OK until you are returned to the Connection
tab of the Data Link Properties dialog.
Click Test Connection. A message should display
notifying you that the test succeeded.
Click OK. You will be returned to the Connection
tab in the Properties dialog. The connection string should
now display in the Database Connection String field.
Under Record Source, select the Unknown
radio button and type Recipes in the text box. Click
OK.
On the graphics page, the Database Exchange ActiveX
control should now display the data from Recipes.DBF.
For more information about setting up different
types of data sources, see the following: