12. Database
Projects
Project
using
the
DBGrid
Control
to
display
the
Database
Table:
Let us
now
consider
a
project
to
display
the
database
table
we
created
earlier
in a
DBGrid
Box.
Controls
used
in
this
Project:
In
this
example
project
we
are
going
to
use
the
following
Controls.
1.
DB
Grid
Control
(1)
2.
Data
Control
(1)
Start
from
the
opening
Design
Window, drag
the
above
controls
in
the
form,
size
them
and
locate
them
in
the
form as
shown
in
the
figure
9. The
DBGrid
control
is
bound
to
the
database
control by
setting
its
data
source
property
as
‘Data1’
The
Data
control
is
connected
to
the
database
by
making
the
Database
name
property
as
‘payroll’
and
the
Record
Source
property
as
‘employee’.
You
must
give
the
database
name
along
with
the
directory
structure. There
is
no
coding
for
this
project. Save
and
run
the
project. The
database
table
is
displayed
in
the
DBGrid
box
as
shown
in
the
figure
10.

Figure
9

Figure
10
Suppose
you
want
to
view
only
selected
records
based
on
some
criteria,
enter
the
criteria
as
the
Record
Source
Property
of
the
Data
Control
as:
Select
*
from
employee
where
salary <
10000
and salary
>
5000
The
output
will
appear
as
shown
in
the
figure
11.
Figure
11
   |