c_jfdel.pas

来自「经典的酒店管理系统」· PAS 代码 · 共 68 行

PAS
68
字号
unit C_JfDel;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, StdCtrls, Buttons, DB, DBTables;

type
  TJfDelForm = class(TForm)
    Label1: TLabel;
    dtpBd: TDateTimePicker;
    Label2: TLabel;
    dtpEd: TDateTimePicker;
    lblTitle: TLabel;
    btnOk: TBitBtn;
    btnCanc: TBitBtn;
    qryWork: TQuery;
    procedure btnOkClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  JfDelForm: TJfDelForm;

procedure JfDel;

implementation

{$R *.dfm}
procedure JfDel;
begin
  JfDelForm := TJfDelForm.Create(Application);
  try
    with JfDelForm do
    begin
      dtpBd.Date := Date;
      dtpEd.Date := Date;
      ShowModal;
    end;
  finally
    JfDelForm.Free;
  end;
end;

procedure TJfDelForm.btnOkClick(Sender: TObject);
var
  BDt,EDt,s: string;
begin
  BDt := FormatDateTime('yyyymmdd',dtpBd.Date);
  EDt := FormatDateTime('yyyymmdd',dtpEd.Date);
  s := 'delete  from NewData where (SDate>="'+BDt+'")and(SDate<="'+EDt+'")';
  with qryWork do
  begin
    if Active then Active := False;
    SQL.Clear;
    SQL.Add(s);
    Prepare;
    ExecSQL;
  end;
  Close;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?