Page 227 - Open Soource Technologies 304.indd
P. 227
Unit 10: Database Fundamentals and Connectivity Option
Introduction
The management of databases is the number one use of computers today. Airlines use databases
to handle nearly 1.5 billion passenger reservations per year. The 6,500 hospitals in the United
States utilize databases to document the care of over 30 million patients per year. Banks in the
United States utilize databases to monitor the use of 350 million credit cards. Although databases
vary considerably in size and complexity, most of them adhere to the fundamental principles of
design discussed in this chapter. That is, they are composed of a collection of interrelated tables.
10.1 The Data Control
The data control enables to move around in a database from record to record and to display and
manipulate data from the records in bound controls. This control displays a set of arrow buttons
the user can manipulate to move through a database, and the records from that database are
displayed in bound controls. We can see a data control operating with bound controls in
Figure 10.1, where we placed our students table into a database and opened it with a data control.
Figure 10.1: Using a Data Control.
In fact, we can perform most data access operations using the data control—without writing any
code. Data-bound controls automatically display data from one or more fields for the current
record, and the data control performs all operations on the current record. If the data control is
made to move to a different record, all bound controls automatically pass any changes to the
data control to be saved in the database. The data control then moves to the requested record
and passes back data from the current record to the bound controls where it’s displayed. When
an application begins, Visual Basic uses data control properties to open a selected database, create
a DAO Database object, and create a Recordset object. The data control’s Database and Recordset
properties refer to those Database and Recordset objects, and we can manipulate the data using
those properties. For example, if we have an SQL statement to execute, we place that statement
in the data control’s RecordSource property, and the result appears in the Recordset property.
LOVELY PROFESSIONAL UNIVERSITY 221