Skip Headers

Oracle® Objects for OLE Developer's Guide
10g Release 1 (10.1)

Part Number B10118-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
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.