Oracle Objects for OLE
Release 9.2

Part Number A95895-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback

Querying the Database

See Also
Quick Tour
Employee Form

We can configure our application to allow users to search for particular records in the database. For demonstration purposes, we include a Find button to allow users to query only employee names. At any time, the user can enter the query in the Employee Name textbox and click on the Find button. Our application then either displays the result, or displays a message if the name cannot be found.

To search for records, we use the DbFindFirst method. When the find succeeds, we display the record. When the find fails, we display a message. We also reset the current row to the first, since failures cause the dynaset to be BOF, effectively making the current row invalid.

Our Find_Click() event procedure does the following:

  1. Builds a find clause to find the record where the ENAME column matches the entered string.

  2. Executes the find using DbFindFirst.

  3. Displays the record if found; if not found, displays a message and resets the current row to first.