Each time you call SetKey or FindKey, the method clears any previous values in the Fields property. If you want to repeat a search using previously set fields, or you want to add to the fields used in a search, call EditKey in place of SetKey and FindKey.
For example, suppose you have already executed a search of the Employee table based on the City field of the "CityIndex" index. Suppose further that "CityIndex" includes both the City and Company fields. To find a record with a specified company name in a specified city, use the following code:
Employee.KeyFieldCount := 2; Employee.EditKey; Employee['Company'] := Edit2.Text; Employee.GotoNearest;
Employee->KeyFieldCount = 2; Employee->EditKey(); Employee->FieldValues["Company"] = Variant(Edit2->Text); Employee->GotoNearest();
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|