EPUB | CHM | PDF

TMySQLTable.Methods.GotoNearest

Top Previous Next

Moves the cursor to the record that most closely matches the current key.

Syntax:

procedure GotoNearest;

Description:

Call GotoNearest to position the cursor on the record that is either the exact record specified by the current key values in the key buffer, or on the first record whose values exceed those specified.

note KeyExclusive determines which records are considered part of a search range.

Before calling GotoNearest, an application must specify key values by calling SetKey or EditKey to put the dataset is dsSetKey state, and then use FieldByName to populate the key buffer property with search values.

note If some field from multi-field index is not assigned with a value after EditKey call it will not be used for search.

Delphi 7 and prior has poor support for int64 values in variant type. This means that you'll be unable to use Locate and similar methods with such fields. Lookup fields and master-detail tables will not work properly too because of their dependence on Locate method. Please update your IDE to BDS 2006 (or later) or don't use BIGINT and UNSIGNED INT datatypes for keys and indexes if you need to use them in lookup fields. Also you can't use variant-style properties (FieldValuesAsVariant and so on) with such fields.

See also: SetKey method, KeyExclusive property, SetKey,GotoNearest example