Show: Delphi C++
Display Preferences

Emptying Tables

From RAD Studio XE2
Jump to: navigation, search

Go Up to Understanding datasets Index

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.

See Also

Personal tools
Previous Versions
In other languages