Delphi Community Edition database tutorials, part 1
|
Delphi Community Edition databasesWith the free Delphi Community Edition you can build database applications. Delphi CE contains components for TClientDataSet, TFDConnection (FireDac database), TDataSource, TDBGrid, TDBEdit, and more. IntroLet's consider the example of a database for a books library. The card catalog was a familiar sight to library users for generations. It contained catalog drawers for the books (with a reference card for each book), drawers with cards for the members (borrowers) and drawers for the lendings (loans). Additionally, there could be catalogs for authors, keywords, etc. In the traditional books catalog, each card contains bibliographic information about one book, including the title, subject, author’s name, date of publication, ISBN number, and maybe even approximate location (on bookshelf). In a digital database, we use the following designations:
Database componentsIn a Delphi database application, you need at least:
For this set of our tutorials, we'll use Delphi's TClientDataSet component. It represents an in-memory dataset, that can be used as a fully-functional, stand-alone, file-based dataset. It can read / write its data from/to a file on a storage device (e.g. hard disk) Note: you can also use SQLite for database applications: see our SQLite tutorial. MyBase: stand-alone ClientDataSetFor a single-user database application in Delphi, the simplest approach is to use a ClientDataSet component
and map it to a local file. This is different from the traditional data mapping to a file.
The traditional approach is to read from the file a record at a time. MyBase is used as a synonym for ClientDataSet. It's also called the Briefcase Model. MyBase generally saves the data in XML format, although the binary CDS format is also available. |
Table of contents
1. INTRO TO DATABASES 2. SET UP TCLIENTDATASET 3. SAVE TO / LOAD FROM FILE 4. IMPROVING DATA ENTRY 5. VALIDATING AND MORE See also: SQLITE TUTORIALS
|
Crash Course Delphi Database tutorials Delphi Starter FAQ Tips Source Code Downloads Links