⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deleteinfosrc.~pas

📁 该程序可作为386的接警程序使用
💻 ~PAS
字号:
unit DeleteInfoSrc;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids, DBGrids;

type
  TFormDeleteInfo = class(TForm)
    DBGrid1: TDBGrid;
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    ComboBoxDeleteInfo: TComboBox;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    procedure ButtonOKClick(Sender: TObject);
    procedure ButtonDelAllClick(Sender: TObject);
    procedure ButtonDeleteClick(Sender: TObject);
    procedure ButtonCancelClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormDeleteInfo: TFormDeleteInfo;

implementation
uses
BJInfoSrc,QDialogs, BJDataSrc;
{$R *.dfm}

procedure TFormDeleteInfo.ButtonOKClick(Sender: TObject);
var
     strSQL:string;
begin
     strSQL := 'select * from 报警信息 where ' + ComboBoxDeleteInfo.Text + ' like ' + '"%'+ Edit1.Text + '%"';
     FormBJInfo.ADOQuery1.Close;
     FormBJInfo.ADOQuery1.SQL.Clear;
     FormBJInfo.ADOQuery1.SQL.Text := strSQL;
     FormBJInfo.ADOQuery1.Open;
end;

procedure TFormDeleteInfo.ButtonDelAllClick(Sender: TObject);
var
     strSQL:string;
begin
     strSQL := 'Delete * from 报警信息';
     FormBJData.ADOQuery1.Close;
     FormBJData.ADOQuery1.SQL.Clear;
     FormBJData.ADOQuery1.SQL.Text := strSQL;
     FormBJData.ADOQuery1.ExecSQL;

     strSQL := 'select * from 报警信息';
     FormBJData.ADOQuery1.Close;
     FormBJData.ADOQuery1.SQL.Clear;
     FormBJData.ADOQuery1.SQL.Text := strSQL;
     FormBJData.ADOQuery1.ExecSQL;

     DBGrid1.ReadOnly:=false;
     FormBJData.ADOQuery1.Open;
     while not FormBJData.ADOQuery1.Eof do
     begin
          FormBJData.ADOQuery1.Delete;
          //FormBJData.ADOQuery1.Next;
     end;
     DBGrid1.ReadOnly:=true;
end;

procedure TFormDeleteInfo.ButtonDeleteClick(Sender: TObject);
begin
     if FormBJInfo.ADOQuery1.IsEmpty then
     begin
           ShowMessage('已经没有记录可删除!');
           Exit;
     end;
     FormBJInfo.ADOQuery1.Delete;
     Edit1.Text := '';
end;

procedure TFormDeleteInfo.ButtonCancelClick(Sender: TObject);
begin
    Close;
end;

end.

⌨️ 快捷键说明

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