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

📄 login.pas

📁 一个简单的DELPHI的图书管理系统,具有一般图书管理系统的基本功能!-
💻 PAS
字号:
unit login;

interface

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

type
  TloginForm = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    namebox: TEdit;
    pwdbox: TEdit;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    leixingbox: TComboBox;
    Label3: TLabel;
    DataSource1: TDataSource;
    ADOTable1: TADOTable;
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  loginForm: TloginForm;

implementation
uses DataModule,main;
{$R *.dfm}

procedure TloginForm.BitBtn2Click(Sender: TObject);
begin
if messagedlg('真的要退出系统吗?',mtconfirmation,[mbYes,mbNo],0)=mryes then Close;
end;

procedure TloginForm.BitBtn1Click(Sender: TObject);
 var
 i:integer;

begin
  if(leixingbox.ItemIndex=1) then
    begin
    if ((namebox.Text='admin') and (pwdbox.text='admin'))  then
    begin
      mainform.N1.Enabled:=true;
      mainform.N7.Enabled:=true;
      namebox.text:='';
      pwdbox.Text:='';
      close;
    end
    else if namebox.Text<>'admin' then
      begin application.MessageBox('非法用户,请输入正确的用户名','用户名',mb_ok+mb_iconexclamation);
        namebox.SetFocus;
      end
      else
      begin
        application.MessageBox('输入密码错误,请再输入一次','密码',mb_ok+mb_iconexclamation);
        pwdbox.SetFocus;
      end;
      end
   else
      begin
        adotable1.Open;
        adotable1.First;
        for i:=1 to adotable1.RecordCount do
        begin
          if (adotable1.FieldbyName('name').AsString=namebox.Text) and (adotable1.FieldbyName('password').AsString=pwdbox.Text) then
          begin
            mainform.N7.Enabled:=true;
            namebox.text:='';
            pwdbox.Text:='';
            loginForm.Close;
            break;
          end
          else
            adotable1.next;
            if i=adotable1.RecordCount then
            showmessage('用户不合法');
           end;
        adotable1.close;
     end;
end;
procedure TloginForm.FormCreate(Sender: TObject);
begin
  adotable1.Connection:=datamoduleado.ADOConnection1;
end;

end.

⌨️ 快捷键说明

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