RAD Studio VCL Reference
TCustomADODataSet.CommandType Property

Specifies the type of command to execute.

property CommandType: TCommandType;
__property TCommandType CommandType;

Set CommandType to indicate the type of command that is contained in the CommandText property. The value in CommandType should agree with that of CommandText. For instance, if CommandText is the name of a table, CommandType should be cmdTable or cmdTableDirect. 

The default value of CommandType is cmdUnknown. While CommandType may be left as cmdUnknown for all commands, better performance will be realized if CommandType is used to explicitly indicate the type of the command. When the type cmdUnknown is used, ADO must evaluate the command to determine its type, which slows the operation.

with ADODataSet1 do begin
  CommandType := cmdText;
  CommandText := 'SELECT * FROM CustomerTable';


ADODataSet1->CommandType = cmdText;
ADODataSet1->CommandText = "SELECT * FROM CustomerTable";


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!