API:FireDAC.Comp.Client.TFDCommand.CommandKind

From RAD Studio API Documentation
Jump to: navigation, search

[–] Properties
Type: property
Visibility: published
Source:
FireDAC.Comp.Client.pas
FireDAC.Comp.Client.hpp
Unit: FireDAC.Comp.Client
Parent: TFDCommand

Delphi

property CommandKind;

C++

__property CommandKind = {default=0};

Description

Identifies the kind of the command.

FireDAC.Comp.Client.TFDCommand.CommandKind inherits from FireDAC.Comp.Client.TFDCustomCommand.CommandKind. All content below this line refers to FireDAC.Comp.Client.TFDCustomCommand.CommandKind.

Identifies the kind of the command.

The CommandKind property identifies the kind of the content of the CommandText property.

You can explicitly set its value before calling Prepare, otherwise it will be automatically assigned by FireDAC after analyzing the CommandText content. There is only one case when you need to assign it: when you prepare a stored procedure.

Example

//Example 1:
ADCommand1.CommandKind := skStoredProc;
ADCommand1.CommandText.Text := 'MY_PROC';
ADCommand1.Prepare;

//Example 2:
ADCommand1.CommandText.Text := 'ALTER PROCEDURE MY_PROC COMPILE';
case ADCommand1.CommandKind of
skAlter: ShowMessage('Alter command');
..........
else     ShowMessage('Other command');
end;

See Also