FireDAC.Comp.DataSet.TFDDataSet.SetKey

From RAD Studio API Documentation
Jump to: navigation, search

[–] Properties
Type:
procedure
function
Visibility: public
Source:
FireDAC.Comp.DataSet.pas
FireDAC.Comp.DataSet.hpp
Unit: FireDAC.Comp.DataSet
Parent: TFDDataSet

Delphi

procedure SetKey;

C++

void __fastcall SetKey();

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