RAD Studio
ContentsIndex
PreviousUpNext
Using the Execute Method

Before TADOCommand can execute its command, it must have a valid connection to a data store. This is established just as with an ADO dataset. See Connecting an ADO dataset to a data store for details. 

To execute the command, call the Execute method. Execute is an overloaded method that lets you choose the most appropriate way to execute the command. 

For commands that do not require any parameters and for which you do not need to know how many records were affected, call Execute without any parameters:

with ADOCommand1 do begin
  CommandText := "UpdateInventory";
  CommandType := cmdStoredProc;
  Execute;
end;

 

ADOCommand1->CommandText = "UpdateInventory";
ADOCommand1->CommandType = cmdStoredProc;
ADOCommand1->Execute();

Other versions of Execute let you provide parameter values using a Variant array, and to obtain the number of records affected by the command. 

For information on executing commands that return a result set, see Retrieving result sets with commands.

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