RAD Studio
ContentsIndex
PreviousUpNext
Emptying Tables

Many table type datasets supply a single method that lets you delete all rows of data in the table.

Table Type 
Method 
TTable and TIBTable  
You can delete all the records by calling the EmptyTable method at runtime: PhoneTable.EmptyTable; PhoneTable->EmptyTable();  
TADOTable  
You can use the DeleteRecords method: PhoneTable.DeleteRecords; PhoneTable->DeleteRecords(arAll);  
TSQLTable  
You can use the DeleteRecords method. Note, that the TSQLTable version of DeleteRecords never takes any parameters: PhoneTable.DeleteRecords; PhoneTable->DeleteRecords();  
EmptyDataSet  
For client datasets, you can use the EmptyDataSet method: PhoneTable.EmptyDataSet; PhoneTable->EmptyDataSet();  

Note: For tables on SQL servers, these methods only succeed if you have DELETE privilege for the table.
Warning: When you empty a dataset, the data you delete is gone forever.

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