如何右键弹出菜单中清空表中数据,删除数据前提问确定
1 procedure TForm3.N2Click(Sender: TObject); 2 begin 3 try 4 with TADOQuery.Create(nil) do 5 begin 6 Connection := frmDataPool.ADOConnection1; 7 if messagedlg('删除所有记录?',mtconfirmation,[mbyes,mbno],0)<>mryes then 8 Abort 9 else 10 begin 11 SQL.Text := 'DELETE FROM 工资表'; 12 ExecSQL; 13 end; 14 //防止程序假死 15 Application.ProcessMessages; 16 //刷新下显示 17 frmDataPool.qry工资表.Close; 18 frmDataPool.qry工资表.Open; 19 20 end; 21 finally 22 TADOQuery.Create(nil).Free; 23 end;