RAD Studio
ContentsIndex
PreviousUpNext
Executing the Command

To execute a query or stored procedure that does not return any records, you do not use the Active property or the Open method. Instead, you must use 

The ExecSQL method if the dataset is an instance of TSQLDataSet or TSQLQuery.

FixTicket.CommandText := 'DELETE FROM TrafficViolations WHERE (TicketID = 1099)';
FixTicket.ExecSQL;

 

FixTicket->CommandText = "DELETE FROM TrafficViolations WHERE (TicketID = 1099)";
FixTicket->ExecSQL();

The ExecProc method if the dataset is an instance of TSQLStoredProc.

SQLStoredProc1.StoredProcName := 'MyCommandWithNoResults';
SQLStoredProc1.ExecProc;

 

SQLStoredProc1->StoredProcName = "MyCommandWithNoResults";
SQLStoredProc1->ExecProc();

 

If you are executing the query or stored procedure multiple times, it is a good idea to set the Prepared property to True.

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