Delphi Delete all records from FDTable

userhi picture userhi · Jan 6, 2017 · Viewed 7.7k times · Source

Iam trying to delete all records in my FDTable component using ,

mytable.Delete;

but no record is getting deleted.

can any one suggest me a way to delete all records in a FdTable.

EDIT

i modified it in this way,

  for i := mytable.RecordCount - 1 downto 0 do
  begin
    mytable.Delete;
  end;
  mytable.Refresh;

but it is taking lot of time because there a lot rows in my fdtable.

Answer

MartynA picture MartynA · Jan 6, 2017

Try

MyTable.EmptyDataSet;

There may be a bit more to do than that, but you don't say how you are populating MyTable in the first place.