📄 login.pas
字号:
unit Login;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls, SUIEdit, SUIComboBox, jpeg, ExtCtrls,
SUIButton;
type
TFrmLogin = class(TForm)
qurLogin: TADOQuery;
BtnOK: TsuiButton;
BtnClose: TsuiButton;
Image1: TImage;
ComboBox1: TsuiComboBox;
Edit1: TsuiEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure FormShow(Sender: TObject);
procedure BtnOKClick(Sender: TObject);
procedure BtnCloseClick(Sender: TObject);
private
{ Private declarations }
password:array of String;
public
{ Public declarations }
end;
var
FrmLogin: TFrmLogin;
implementation
uses database, MyMath;
{$R *.dfm}
procedure TFrmLogin.FormShow(Sender: TObject);
var i:integer;
begin
edit1.Clear;
ComboBox1.Clear;
i:=0;
SetLength(password,1);
qurlogin.Close;
qurlogin.SQL.Clear;
qurlogin.SQL.Add('select 用户名,密码 from 用户信息');
qurlogin.Open;
qurlogin.First;
while not qurlogin.Eof do begin
ComboBox1.Items.Add(qurlogin.FieldByName('用户名').AsString);
password[i]:=qurlogin.FieldByName('密码').AsString;
inc(i);
SetLength(password,Length(password)+1);
qurlogin.Next;
end;
ComboBox1.ItemIndex:=0;
edit1.SetFocus;
end;
procedure TFrmLogin.BtnOKClick(Sender: TObject);
begin
if ComboBox1.Text = '' then begin
InfoOk('找不到用户信息');
exit;
end;
if edit1.Text = password[ComboBox1.ItemIndex] then begin
gLogin:=True;
gLoginName:=ComboBox1.Text;
gLoginPass:=edit1.Text;
gLoginTime:=formatdatetime('yyyy-mm-dd-H:mm:ss',now);
Close;
end
else Infook('密码不正确');
end;
procedure TFrmLogin.BtnCloseClick(Sender: TObject);
begin
close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -