Como Apagar todos os registros de uma tabela ?

Delphi

14/08/2003

tenho o seguinte comando :

table1.open;
if MessageDlg(´Tem certeza que deseja apagar este registro?´,
mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin
table1.delete;
table1.edit;
end

isso faz com que o registro atual seja apagado.

´´ COMO FAZER COM QUE TODOS OS REGISTROS SEJA APAGADOS ? ´´´


WESLEY - PARACATU-MG


Wesleygoncavles

Wesleygoncavles

Curtidas 0

Respostas

Okama

Okama

14/08/2003

Com Table

While not Table1.isEmpty do 
    Table1.Delete;


Com Query

Query1.SQL.Text := ´Delete from Tabela´; 
Query1.ExecSQL;



GOSTEI 0
Dr. Interbase

Dr. Interbase

14/08/2003

coloque um componente tquery no form e faça assim
qrydeleta.sql. clear;
qrydelete.sql.add(´delete from tabela´);
qrydelete.execsql;

Pronto todos os registros serão apagados


GOSTEI 0
Vmotta

Vmotta

14/08/2003

use isso:

table1.EmptyTable;

t+
Vitor <vmotta@eep.br>


GOSTEI 0
POSTAR