3164:How to Get the Most Out of DBDEMOS
KEYWORDS: DBDemos, DemoExplorer, examples, Explorer AREA: Application Interop
OVERVIEW:
To most Delphi Developers, DBDEMOS is just an alias, but this TI
will show that DBDEMOS is more than just sample tables. Included
with Delphi 2.0 is the Delphi Demo Explorer where you can easily
choose to view a wide range of sample applications, based on concept
or by example. Also included in this TI is a directory listing of
where to find various other examples and demonstrations included with
the Delphi 2.0 CD.
TARGET AUDIENCE:
This TI is aimed at all developers, from beginning to master
programmers. Although beginners will be able to run though these
examples in order to grasp fundamental Delphi concepts, the master
programmers can use this as a reference sheet in order to gain more
experience and to research further in any particular area.
DELPHI 2.0 DEMO EXPLORER
------------------------
The Demo Explorer allows you to browse through a database of all
Delphi demonstration programs. As outlined in
\info\Borland\Demoexpl\Readdx.Txt on the Delphi 2.0 CD, follow the
directions below to install the Delphi 2.0 Demo Explorer:
1. Close Delphi 2.0 if it is running.
2. Create a \DemoExpl directory off of the directory in which you
installed Delphi 2.0.
(i.e., c:\Program Files\Borland\Delphi 2.0\DemoExpl).
3. Copy all of the files from the \info\borland\demoexpl directory
of the Delphi 2.0 CD-ROM to the directory you created in step 1.
4. Use the Run option from the Start menu to run the REGEDIT
application. Find:
\HKEY_CURRENT_USER\Software\Borland\Delphi\2.0\Experts
key by expanding the tree view in the left pane of the Registry
Editor window. If you have no experts key then you must create
one.
5. Highlight the Experts key in the left pane, and right click on
the right pane of the Registry Editor window. From the local
menu, select New|String value, enter "DemoExplorer" as the new
value, and press the Enter key.
6. Right click on DemoExplorer in the right pane, and select Modify
from the local menu. This will invoke the Edit String dialog.
In this dialog, enter the full path from step 1 followed by
"\demoexpl.dll". For example:
c:\Program Files\Borland\Delphi 2.0\DemoExpl\demoexpl.dll.
7. Demo Explorer is now installed. Run Delphi 2.0, and you can
invoke Demo Explorer by selecting "Explore Sample Applications"
from the Help menu.
WHERE TO FIND DB DEMOS, DATA AND RELATED FILES
----------------------------------------------
1. \Demos\DB contains 17 directories of demonstration database
related projects.
2. \Doc
a) \Dataedit
b) \DBCal
3. \Demos\Data contains Interbase, Paradox, dBase tables, indexes,
validation, memos, bitmaps.
4. \Iblocal\Examples contains Interbase tables Employee.GDB and
INTlemp.GDB for Delphi 1.0.
5. \IntrBase\Examples) contains Interbase tables Employee.GDB and
INTlemp.GDB for Delphi 2.0.
6. \Source\Samples
a) Ibctrls.pas
b) IBEvents.pas
c) IBProc32.pas
DELPHI 1.0 EXAMPLES
-------------------
1. Animals:
Simplest possible example using data aware controls
and a dBase table. See also FishFact.
2. BDEDLL:
Demonstrates use of the BDE within a DLL for Delphi
1.0. If the customer is having trouble with a DLL that uses BDE
they may check the comments in these two projects. Note: If
"DB" appears in the uses clause of a unit, they are using BDE.
This is because DB.PAS contains an initialization section that
automatically starts the Borland Database Engine. For example,
if a data aware control is dropped on the form, DB will be added
to the uses clause, and when the application is run, BDE will
start, even if the data aware control is removed at a later time.
3. CalcFlds:
Demonstrates assigning values to calculated fields
where looking into a secondary table is necessary.
4. Datalist:
Populates list boxes with list of available
databases, tables, fields and indexes for a given session.
5. DBAware1:
Demos the use of TDBEdit, TDBComboBox, and TDBListbox.
6. DBAware2:
Demos the use of TDBLookupCombo and TDBLookupList.
The use of TDBLookupCombo and TDBLookupList are commonly
misunderstood - this project shows these controls being used for
their intended use.
7. FishFact:
Simplest possible example using data aware controls
and a Paradox table. See also Animals.
8. Format:
Though not specifically a database application, this
project demonstrates the use of the Format function to manipulate
the display of floating point numbers.
9. InsQuery:
Demonstrates inserting and deleting records from a
server table using SQL statements containing parameters.
10. LinkQry:
Displays two grids of master and detail records
where the relationship between the master and child tables is
performed through a parameterized query.
11. MastApp:
A complete order entry system with functionality to
add, modify, browse and report on orders, customers, parts, and
items. Also contains application help, and comments within the
main unit on upsizing from the default Paradox to Interbase.
12. QJoin:
An example of joining two tables using SQL statements.
Displays customer and order records where customer numbers match.
13. Range:
Demonstrates the use of SetRangeStart, SetRangeEnd,
ApplyRange, and CancelRange.
14. Search:
Demonstrates a single search for customer number
executed from a button click.
15. Stocks:
Stock charting application including Market Browser,
Industry Charts, Customer Details, Customer Charts, and
reporting. The projects demonstrates dynamically population of
combo boxes used in turn for dynamically created SQL statements
and Chart FX.
16. Tools:
Review the Readme.txt file in this directory for more
information on setting up these projects. Here's an excerpt from
the read me:
* These demos show examples of:
* An example database MDI application (DBBROWSE.DPR)
* An example database popup application (SQLMON.DPR)
* An example of how to derive new database components for the
Borland Database Engine system tables (BDETABLES.PAS)
* An example of how to use the database error stack available in
the VCL exception class EDbEngineError. This exception is
raised when a Borland Database Engine error occurs (DBEXCEPT.*)
17. TwoForms:
Shows data aware controls on two forms kept in sync
by accessing a common dataset control (a TTable) located on the
first form.
DELPHI 2.0 EXAMPLES
-------------------
1. BdQuery:
Demonstrates how to execute a query in a background thread.
2. CachedUp:
This example demonstrates how cached updates can be
used with live data and in conjunction with the UpdateSQL
component for non-live data. See About.txt in this same
directory for more information.
3. CsDemos:
Demonstrates Client/Server concepts, including
triggers, stored procedures executed from both TStoredProc and
TQuery, and transactions.
4. CtrlGrid:
A Stock browser showing detail data in a TDBCtrlGrid.
5. DbErrors:
This example represents a sampling of the way that
you might approach trapping a number of database errors. See
comments in the data module of this project.
6. Filter:
Customer/Orders browser allowing a number of query
and table based filters. A second form allows building and
executing filters over the customer table at runtime.
7. Find:
Demonstrates record location and incremental searches
on filtered and un filtered tables. Includes examples of
FindNearest, Locate, and GoToCurrent usage.
8. GdsDemo:
Order entry application for "Global Diving Supply"
with grid and single record views.. This project allows you to
experiment with the effects of form inheritance. The project
contains two sets of both grid and single record forms which
allows you to change the "GDS standard" form and watch the
effects on the inherited form. The project also demonstrates
techniques for calculating fields, record filtering, and
locating records that match the filter, using FindFirst,
FindNext, FindPrior, or FindLast.
9. IBDemo:
Demonstrates listing, registering, and generating
InterBase events. The project also includes the TIbEventAlerter
component from the samples component palette page.
10. Lookup:
Example of "lookup" TFields that allow for drop down
combos within a TDBGrid. This feature currently available in
Delphi 2.0.
11. NavMDI:
Master and detail data displayed on separate MDI
forms, and navigator displayed in the MDI parent.
12. NavSDI:
Navigator, master and detail each displayed on separate forms.
13. NdxBuild:
Utility to rebuild indexes for one or all tables
within a given alias. Contains code using the BDE API (the
dbiRegenIndexes function ), application level exception handler,
and listing of alias for a given session.
14. QBFDemo:
This example shows a way to provide users with the
ability to define their own queries. If your query returns
records, then a Results Viewer displays those results; otherwise,
you'll receive a message indicating that no records matched the
search.
TI