RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomClientDataSet.Execute Method

Executes an SQL command by the provider's dataset.

Pascal
procedure Execute; virtual;
C++
virtual __fastcall Execute();

Execute allows the client dataset to interact with a query or stored procedure that does not generate a result set. Call Execute to execute the command specified by CommandText or the provider's query or stored procedure. If CommandText is not an empty string and the provider Options allow clients to supply a CommandText value, then Execute passes CommandText to the provider along with the Params property (to supply parameters for the statement). Otherwise, Execute tells the provider to apply any Params and execute its associated query or stored procedure. After executing the appropriate statement, the provider returns any output parameters and Execute updates the Params property to reflect them.  

When the application calls Execute, the client dataset receives a BeforeExecute event before the request is passed to the provider component. After the provider executes the query or stored procedure, it returns any output parameters, which are used to update the Params property. Finally, the client dataset receives an AfterExecute event.

Note: Do not use Execute to execute a query or stored procedure that returns a cursor. Most datasets use separate commands to execute queries or stored procedures when they do or don't return data. When a provider passes the Execute command on to its dataset, the dataset uses the command for executing queries or stored procedures that don't return a cursor.
 

 

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