A very common task for a database application is to search for a specific record based on some criteria. In Delphi, ADOExpress components implement record searching methods analogous to those found in the BDE approach. This chapter will walk you through various methods of data seeking and locating while developing ADO based Delphi database applications.
Note: the rest of this chapter deals with the aboutdelphi.mdb MS Access database that was introduced in the first chapter of this course. To use the code examples presented in this chapter, set up the data form with the core components (dataaccess and data-aware) as described in the previous chapters. The following code examples will assume that you are working with the ADOTable component pointing to the Applications table in our database.
When you think of it, a searching algorithm could look like: start at the top of the table, examine the field in each row - to see if it matches the criteria, stop the loop on the selected record or at the bottom row - whichever comes first. Hopefully, Delphi hides those *steps* from us. There are several ways to locate a record in a dataset retrieved by an ADODataset (Table or Query) component.
Was this article helpful?