1. Computing & Technology

Discuss in my forum

Data Browsing and Navigation in Delphi Database Applications

By , About.com Guide

6 of 6

Let There Be Data Editing Delphi Form
Data Browsing and Navigation in Delphi Database Applications
Ok, all set up. Everything we have to do now is to activate the connection and scroll through the records. The Active property of a dataset component (ADOTable1) indicates whether we have a live connection to the table or not. Setting Active to True or calling the Open method sets the Connected property of the ADOConnection1 to True - and displays the data in related data-aware controls.

First, Move by, Last,...

You are finally ready for some action. The next step is to see how to "walk" through the recordset.

The DBNavigator component gives a simple and friendly tool for navigating through the recordset. In addition to it's navigational abilities, the DBNavigator provides means for manipulating the data with actions like Insert, Delete or Cancel the changes. For example, if the we click the Delete button, the correct record is deleted from the DBGrid - and from tabase table! Each button is optional and you can mix and match at will.

Using the buttons set you can skip to the last record or move to the previous one. For example, clicking on the Last button sets the current record to the last record in the recordset and disables the Last and Next buttons. Clicking the Last button is functionally the same as calling the Last method of a dataset.

Note that one of the navigational operations that the DBNavigator cannot process is moving forward or backward in a recordset by a number or records. The MoveBy method of a dataset is used to position the cursor on a record relative to the active record in the recordset.

That's it for this chapter. We are now ready to move on to topics like editing and searching the recordset, expect to learn about that in the following chapters of this course...

©2012 About.com. All rights reserved.

A part of The New York Times Company.