Topic: Clear all content of table
Hello,
Could someone explain to me how to make a button that will erase the entire contents of a table and leave the counter to zero?
Thanks,
My Visual Database → General → Clear all content of table
Hello,
Could someone explain to me how to make a button that will erase the entire contents of a table and leave the counter to zero?
Thanks,
Hello,
You can do it using script, example:
procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
begin
Form1.TableGrid1.ClearRows;
end;
Hello,
You can do it using script, example:
procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean); begin Form1.TableGrid1.ClearRows; end;
Thanks Dimitri!
But this only clear the grid. I want erase all records from a table of a database, inluded field named "ID". Could you help me please?
Hello meideprac-x
You can use this script behind a button :
procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
begin
SQLExecute('DELETE FROM Employees');
end;
Be careful : You can't come back with deleted data,
but the structure of your table is always available
JB
Thanks JB!!! Thats works fine, but now, how can I reset to 0 field IDENTITIE for this cleared table??
Using Jean's example you can do the following to reset the ID field in the EMPLOYEES table:
SqlExecute('Delete from sqlite_sequence where name=''Employees''');
Using Jean's example you can do the following to reset the ID field in the EMPLOYEES table:
SqlExecute('Delete from sqlite_sequence where name=''Employees''');
Thanks ehwagner!! Works OK
My Visual Database → General → Clear all content of table
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi