Navigation with SQL

UltraLite for M-Business Anywhere provides you with many methods to navigate a result set to perform a wide range of navigation tasks.

The following methods of the ResultSet object allow you to navigate your result set:

  • moveAfterLast   moves to a position after the last row.

  • moveBeforeFirst   moves to a position before the first row.

  • moveFirst   moves to the first row.

  • moveLast   moves to the last row.

  • moveNext   moves to the next row.

  • movePrevious   moves to the previous row.

  • moveRelative   moves a certain number of rows relative to the current row. Positive index values move forward in the result set, negative index values move backward in the result set, and zero does not move the cursor. Zero is useful if you want to repopulate a row buffer.

Example

The following code fragment demonstrates how to use the moveFirst method to navigate within a result set.

PrepStmt = conn.prepareStatement( 
    "SELECT ID, Name FROM customer", null );
MyResultSet = PrepStmt.executeQuery( null );
MyResultSet.moveFirst();

The same technique is used for all the move methods.

For more information about these navigational methods, see ResultSet class.