llyhunit1.~pas

来自「这是一个Delphi很好很全面知识的实例」· ~PAS 代码 · 共 66 行

~PAS
66
字号
unit LLYHUnit1;

interface

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

type
  TLLYHForm = class(TForm)
    GroupBox1: TGroupBox;
    DBGrid1: TDBGrid;
    GroupBox2: TGroupBox;
    BitBtn1: TBitBtn;
    BitBtn3: TBitBtn;
    GroupBox3: TGroupBox;
    Label1: TLabel;
    Edit1: TEdit;
    DataSource1: TDataSource;
    ADOTable1: TADOTable;
    ADOQuery1: TADOQuery;
    procedure BitBtn3Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  LLYHForm: TLLYHForm;

implementation

uses MDUnit1, mainUnit1;

{$R *.dfm}

procedure TLLYHForm.BitBtn3Click(Sender: TObject);//浏览
begin
 llyhform.ADOTable1.Active:=true;
end;

procedure TLLYHForm.BitBtn1Click(Sender: TObject);  //删除用户
begin
if (edit1.text='') then messagedlg('您还没有添写要删除的编号',mtinformation,[mbyes],0) 
else if messagedlg('是否确认修改?',mtinformation,[mbyes,mbno,mbcancel],0)=mryes then
 begin
  ADOQuery1.Close;
  ADOQuery1.SQL.Clear;
  ADOQuery1.SQL.Add('delete * from 密码表 where 编号=:no');
  ADOQuery1.Parameters.ParamByName('no').Value:=edit1.Text;
  ADOQuery1.ExecSQL;
end;
 ADOTable1.Active:=false;
 edit1.Text:='';
end;
procedure TLLYHForm.FormClose(Sender: TObject; var Action: TCloseAction);//浏览用户
begin
  mainform.n16.Enabled:=true;
  free;
end;

end.

⌨️ 快捷键说明

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