Much Rapid Application Development (RAD) work is based on providing a user-friendly front end to a database, and there is plenty of specialist knowledge to acquire. This section provides a taster to working with databases. We treat this important topic in greater depth in a dedicated tutorial.
A DBGrid is an example of a data aware component. It is an automated version of a string grid and behaves as a rectangular grid made up of rows and columns of DBEdit boxes. In both Lazarus and Delphi it is in the Data Controls tab of components. You should use it with other components designed to link up to databases. You need a connection to a database, a data set and a data source. The following sections describe the use of a DBGrid in Delphi and Lazarus. In each case, we link to a Microsoft Access database table. (This contains useful, relevant data about common components available in Delphi). The Delphi example benefits from an ADOTable control, which has no direct equivalent in Lazarus. We found it much easier to use than the SQL approach in Lazarus. Certain database components are designed to work together and you can link them easily by accepting the only option in a drop-down list in the Object Inspector. In the following demonstrations, we do not always rename a component such as DataSource1 if it is the only one of its type.