Appendix B
Citadel and Open Database Connectivity
B-14
©
National Instruments Corporation
Using the Citadel ODBC Driver in Visual Basic is the same as using any
other ODBC driver. To retrieve and view data, create a Data control and at
least one text control.
First place a Data control on an open form. Set its Connect property to
DSN=Citadel
(or the name of the Citadel data source) and double click its
Record Source property to identify Threads as its source table.
You can leave the Record Source property set to Threads if you want to
select all of the data for all of the threads in the Citadel database, or you can
narrow your query by entering an SQL select statement in the Record
Source property. For example, to retrieve LocalTime, Liquid, and Powder
where LocalTime is greater than 10/20/95 18:00:00 and less than 18:30:00,
and where Interval is one minute, enter:
SELECT LocalTime, ["Liquid "], ["Powder "]
FROM Threads
WHERE LocalTime > #11/20/95 6:00:00 PM#
AND LocalTime < #11/20/95 6:30:00 PM#
AND Interval = '1:0'
You must use the SQL syntax of Microsoft Access in your select statement.
Also remember to use the special characters that are converted for Access
compatibility and double quotes around BridgeVIEW thread names to
identify them as delimited identifiers. Finally, Access SQL requires square
brackets [ ] around identifiers, and #s around time stamps.
Now place a Text control on the form. Set its Data Source property to the
name of your Data control—for example, Data1. Click the Data Field
property to highlight it and then using the property sheet’s drop-down
combo box, select the desired field name. All logged data members should
be listed including LocalTime, Interval, Liquid, etc. Repeat this step for
each data member you want to display on your form.