From RAD Studio API Documentation
Jump to: navigation, search


procedure Execute; virtual;


virtual void __fastcall Execute();


Type Visibility Source Unit Parent
Datasnap.DBClient TCustomClientDataSet


Executes an SQL command by the provider's dataset.

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 do not 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 do not return a cursor.

See Also