Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » UltraLite - M-Business Anywhere Programming » Understanding UltraLite for M-Business Anywhere Development » Working with data using the table API

Accessing the values of the current row Next Page

Searching rows with find and lookup


UltraLite has several modes of operation for working with data. Two of these modes, the find and lookup modes, are used for searching. The ULTable object has methods corresponding to these modes for locating particular rows in a table.

Note

The columns searched using Find and Lookup methods must be in the index used to open the table.

To search for a row
  1. Enter find or lookup mode.

    Call the FindBegin or LookupBegin method. For example, the following code fragment calls ULTable.findBegin.

    tCustomer.findBegin();
  2. Set the search values.

    You do this by setting values in the current row. Setting these values affects the buffer, not the database. For example, the following code fragment sets the last name column in the buffer to Kaminski.

    tCustomer.setString(3, "Kaminski" );

    For multi-column indexes, a value for the first column is required, but you can omit the other columns.

  3. Search for the row.

    Use the appropriate method to carry out the search. For example, the following instruction looks for the first row that exactly matches the specified value in the current index.

    tCustomer.findFirst();