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

SAP Sybase SQL Anywhere 16.0 » UltraLite - .NET Programming » UltraLite.NET application development » Data creation and modification using the ULTable class » Row searches

 

Searching for a row with the find and lookup methods

Use the find and lookup methods to search for a row in a ULTable object.

Prérequis

There are no prerequisites for this task.

 Task
  1. Enter find or lookup mode.

    The mode is entered by calling a method on the table object. For example, the following code enters find mode.

    t.FindBegin();
  2. Set the search values.

    You do this by setting values in the current row. Setting these values affects the buffer holding the current row only, not the database. For example, the following code sets the value in the buffer to Kaminski.

    int lname = t.GetOrdinal( "lname" );
    t.SetString( lname, "Kaminski" );
  3. Search for the row.

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

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

    t.FindFirst();
  4. Search for the next instance of the row.

    Use the appropriate method to perform the search. For a find operation, FindNext locates the next instance of the parameters in the index. For a lookup, MoveNext locates the next instance.

Résultat

The cursor points to the desired row.

Suivant

Perform operations on the row, such as delete, or modify data that pertains to the row.