Using Text Control with a Database

Delphi User's Guide

This chapter describes how to use Text Control to access databases with the Delphi TDBNavigator control. If you are not familiar with the TDBNavigator control please refer to the Delphi documentation.

The source code for this example is contained in the Samples\Delphi\Database sample source directory.

The Sample Program

The sample uses the LoadFromMemory and SaveToMemory methods to store data to the database and vice versa. Not only is the plain text stored, but also all formatting information, e.g. font and paragraph attributes, colors and image file names. The data is stored in RTF format, which is easiest to handle.

The Database sample program is connected to a small data base which contains descriptions of some of Text Control's properties. You can browse through the records of the data base by clicking the TDBNavigator control buttons on the lower left side of the window. If you want to change something in the current record, press the button with the triangle.