FireDAC.Comp.DataSet.TFDDataSet.SetKey
Delphi
procedure SetKey;
C++
void __fastcall SetKey(void);
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
public | FireDAC.Comp.DataSet.pas FireDAC.Comp.DataSet.hpp |
FireDAC.Comp.DataSet | TFDDataSet |
Description
Starts the entering key values mode.
Use SetKey to put the dataset into the dsSetKey
state, clear the current content of the search key buffer, and enable to enter key field values.
Use EditKey to modify existing key field values without initially erasing them.
Example
FDQuery1.IndexFieldNames := 'CUSTOMER_ID;ORDER_DATE';
FDQuery1.SetKey;
FDQuery1.FieldByName('CUSTOMER_ID').AsInteger := 100;
FDQuery1.FieldByName('ORDER_DATE').AsDateTime := EncodeDate(2008, 5, 1);
if not FDQuery1.GotoKey then
ShowMesage('Order is not found');
See Also
- Finding a Record
- FireDAC.Comp.DataSet.TFDDataSet.EditKey
- FireDAC.Comp.DataSet.TFDDataSet.GotoKey
- FireDAC.Comp.DataSet.TFDDataSet.SetRange
- FireDAC.Comp.DataSet.TFDDataSet.SetRangeEnd
- FireDAC.Comp.DataSet.TFDDataSet.SetRangeStart
- FireDAC.Comp.DataSet.TFDDataSet.IndexName
- FireDAC.Comp.DataSet.TFDDataSet.IndexFieldNames
- FireDAC.Comp.DataSet.TFDDataSet.Indexes