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

📄 login.pas

📁 库存管理信息系统 自带数据库 如有什么问题:247848560
💻 PAS
字号:
unit login;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, DB, ADODB, ExtCtrls, SUIEdit, SUIComboBox,
  SUIButton, SUIForm;

type
  Tloginfrm = class(TForm)
    ADOQuery1: TADOQuery;
    Panel1: TPanel;
    Label3: TLabel;
    Label4: TLabel;
    Label1: TLabel;
    Label2: TLabel;
    Image1: TImage;
    suiForm1: TsuiForm;
    bkok: TsuiButton;
    bkclose: TsuiButton;
    combobox1: TsuiComboBox;
    edit2: TsuiEdit;
    edit1: TsuiEdit;
    procedure suitempbkokClick(Sender: TObject);
    procedure loginfrmcreate(Sender: TObject);
    procedure suitempbkcloseClick(Sender: TObject);
    procedure loginfrmclose(Sender: TObject; var Action: TCloseAction);
    procedure loginfrmshow(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  loginfrm: Tloginfrm;
  lilogin:integer;
implementation
 uses main;
{$R *.dfm}

procedure Tloginfrm.suitempbkokClick(Sender: TObject);
begin
   if not adoquery1.Locate('class;name;password',vararrayof([combobox1.Text,edit1.Text,edit2.Text]),[]) then
   begin
   showmessage('密码不正确,请重新输入');
   lilogin:=lilogin+1;
   edit1.SetFocus ;
   edit1.SelectAll ;
   if lilogin>=3 then
    begin
    showmessage('非法用户');
    close;
    application.Terminate ;
    end;
 end
 else
 begin
  if adoquery1.FieldValues['class']='系统管理员' then
  begin
  mainfrm.Show;
  loginfrm.Hide;
  mainfrm.StatusBar1.Panels[1].Text :='当前用户'+''''+edit1.Text+'''' ;
  mainfrm.StatusBar1.Panels[2].Text :='用户角色'+''''+combobox1.Text+'''';
  end

  else
   begin
     mainfrm.N_adduser.Visible:=false;
     mainfrm.Show;
     loginfrm.Hide;
     mainfrm.StatusBar1.Panels[1].Text :='当前用户'+''''+edit1.Text+'''' ;
     mainfrm.StatusBar1.Panels[2].Text :='用户角色'+''''+combobox1.Text+'''';
     end;
 end;
end;

procedure Tloginfrm.loginfrmcreate(Sender: TObject);
begin
with adoquery1 do
begin
  close;
  sql.Clear;
  sql.Add('select * from USER');
  open;
  try
    while not eof do
    begin
     combobox1.Items.Add(fieldbyname('class').AsString) ;
     next;
     end;
     combobox1.ItemIndex:=0;
     finally;
  end;
  end;
lilogin:=0;
end;

procedure Tloginfrm.suitempbkcloseClick(Sender: TObject);
begin
adoquery1.close;
application.terminate;

end;

procedure Tloginfrm.loginfrmclose(Sender: TObject;
  var Action: TCloseAction);
begin
action:=caFree;
end;
procedure Tloginfrm.loginfrmshow(Sender: TObject); 
begin
edit2.setfocus;
end;
end.

⌨️ 快捷键说明

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