AnyDAC
ContentsIndexHome
PreviousUpNext
TADDataSet.EditKey Method

Enables modification of the search key buffer.

Group
Links

Use EditKey to put the dataset into dsSetKey state, preserving the current contents of the search key buffer. 

After call the application can modify indexed fields. To iterate through them use IndexFieldCount and IndexFields properties. Optionally may be edited value of KeyFieldCount and/or KeyExclusive properties.

procedure EditKey;
ADQuery1.IndexFieldNames := 'CUSTOMER_ID;ORDER_DATE';
...
ADQuery1.EditKey;
ADQuery1.FieldByName('ORDER_DATE').AsDateTime := EncodeDate(2008, 5, 2);
if not ADQuery1.GotoKey then
  ShowMesage('Order is not found');
What do you think about this topic? Send feedback!