📄 unit2.pas
字号:
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, jpeg, ExtCtrls;
type
TFormDL = class(TForm)
Panel1: TPanel;
Image1: TImage;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
Edit2: TEdit;
Edit1: TEdit;
procedure FormShow(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormDL: TFormDL;
i :integer=1;
implementation
uses unit3,unit1;
{$R *.dfm}
procedure TFormDL.FormShow(Sender: TObject);
begin
formdl.Left:=round(screen.Width/2)-round(formdl.Width/2);
formdl.Top:=round(screen.Height/2)-round(330/2);
AnimateWindow(Self.Handle,500,AW_VER_NEGATIVE);
edit1.SetFocus;
end;
procedure TFormDL.SpeedButton1Click(Sender: TObject);
begin
if trim(edit1.Text)='' then
begin
application.MessageBox('请输入用户名','提示',64);
edit1.SetFocus;
end
else if trim(edit2.Text)='' then
application.MessageBox('请输入密码','提示',64)
else
begin
try
database.ADO_user.connection:=database.ADOConnection1;
database.ADO_user.close;
database.ADO_user.sql.Clear;
database.ADO_user.sql.Add('select * from 登陆用户表 where username=:a and password=:b');
database.ADO_user.Parameters.ParamByName('a').Value:=trim(edit1.Text);
database.ADO_user.Parameters.ParamByName('b').Value:=trim(edit2.Text);
database.ADO_user.Prepared;
database.ADO_user.Open;
except
application.MessageBox('系统出错!','提示',64);
application.Terminate;
end;
if database.ADO_user.RecordCount>0 then
begin
FormDL.Hide;
FormZ.Show;
end
else
begin
application.MessageBox('用户名或密码错误','提示',64);
Edit1.Clear;
Edit2.Clear;
Edit1.SetFocus;
inc(i);
if i > 3 then
begin
application.MessageBox('对不起,无权使用本系统!','错误',64);
application.Terminate;
end;
end;
end;
end;
procedure TFormDL.SpeedButton2Click(Sender: TObject);
begin
application.Terminate;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -