• The ADO (ActiveX Data Object) data control is the primary
interface between a Visual Basic application and a database. It can be used without
writing any code at all! Or, it can be a central part of a complex database management system. This icon may not appear in your Visual Basic toolbox. If it doesn’t,
select Project from the main menu, then click Components. The Components window
will appear. Select Microsoft ADO Data Control, then click OK. The control will
be added to your toolbox.
• As mentioned in Review and Preview, previous versions
of Visual Basic used another data control. That control is still included with
Visual Basic 6.0 (for backward compatibility) and has as its icon:

Make sure you are not using this data control for the work
in this class. This control is suitable for small databases. You might like to
study it on your own.
• The data control (or tool) can access databases created
by several other programs besides Visual Basic (or Microsoft Access). Some other
formats supported include Btrieve, dBase, FoxPro, and Paradox databases.
• The data control can be used to perform the following
tasks:
1. Connect to a database.
2. Open a specified database table.
3. Create a virtual table based on a database query.
4. Pass database fields to other Visual Basic tools, for display
or editing. Such tools are bound tools (controls), or data aware.
5. Add new records or update a database.
6. Trap any errors that may occur while accessing data.
7. Close the database.
• Data Control Properties:
Align
Determines
where data control is displayed.
Caption
Phrase
displayed on the data control.
ConnectionString
Contains the information used to establish a connection to a database.
LockType
Indicates the type
of locks placed on records during editing (default setting makes databases read-only).
Recordset
A set of records defined
by a data control’s ConnectionString and RecordSource properties. Run-time
only.
RecordSource
Determines the table (or virtual table) the data control is
attached to.
• As a rule, you need one data control for every database
table, or virtual table, you need access to. One row of a table is accessible
to each data control at any one time. This is referred to as the current record.
• When a data control is placed on a form, it appears
with the assigned caption and four arrow buttons:

The arrows are used to navigate through the table rows (records).
As indicated, the buttons can be used to move to the beginning of the table, the
end of the table, or from record to record.