unit1.pas

来自「库存管理系统,刚做好的,功能还没做全,还望包涵」· PAS 代码 · 共 106 行

PAS
106
字号
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    ADOQuery1: TADOQuery;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
    id,password:string;
    timeid:integer;
implementation

uses Unit2, Unit4, Unit3, Unit5, Unit6;

 {$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  if timeid>3 then
  begin
  messagebox(form1.handle,'您输入错误的次数超过限制,单击退出','警告',mb_ok+mb_iconwarning);
  form1.Close;
  end;
    if edit1.text=''then
       messagebox(form1.Handle,'请输入用户号','警告',mb_ok+mb_iconwarning)
     else
       if edit2.text=''then
       messagebox(form1.handle,'请输密码','警告',mb_ok+mb_iconwarning)
     else
       begin

         id:=edit1.Text;
         password:=Edit2.Text;
        with adoquery1 do
          begin
          close;
          sql.Add('select * from 用户表 where 用户ID='+''''+id+'''');
          sql.Add('and 密码='+''''+password+'''');
          open;
          first;
          if recordcount=1 then
             begin
             if radiobutton1.Checked then
               form4.show
             else
               form2.show;
              form1.Hide;
             end
           else
              messagebox(form1.Handle,'无此用户或密码错误','警告',mb_ok+mb_iconwarning);
              edit1.Text:='';
              edit2.text:='';
              timeid:=timeid+1;
           end;
       end;    
end; 


procedure TForm1.Button2Click(Sender: TObject);
begin
if messagedlg('是否关闭窗口(Y/N)?' ,
    mtconfirmation,[mbyes]+[mbno],0)=6 then
    form6.showmodal
       else
   ;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
form4.showmodal
end;

procedure TForm1.FormShow(Sender: TObject);
begin
timeid:=1;
end;

end.



⌨️ 快捷键说明

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