📄 dl.pas
字号:
unit dl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, StdCtrls;
type
Ttlform = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Label2: TLabel;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
Label3: TLabel;
Query1: TQuery;
Query1Xingming: TStringField;
Query1Mima: TStringField;
Label5: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
tlform: Ttlform;
count:integer;
yonghu:string;
havelogon:boolean;
implementation
uses zct;
{$R *.dfm}
procedure Ttlform.Button1Click(Sender: TObject);
begin
if edit1.Text=''then
begin
messageDlg('请输入用户名!',mtInformation,[mbOk],0);
Edit1.SetFocus ;
exit;
end;
if Edit2.Text ='' then
begin
MessageDlg('请输入密码!',mtInformation,[mbOk],0);
Edit2.SetFocus ;
exit;
end;
if (Edit1.Text<>'') and (Edit2.Text <>'') then
begin
count:=count+1;
Query1.Close;
Query1.SQL.Clear ;
Query1.Params.Clear ;
Query1.Params.CreateParam(ftstring,'xm',ptinput).AsString :=Edit1.Text ;
Query1.SQL.Add('select * from yonghu where xingming=:xm');
try
Query1.Open
Except
MessageDlg('无此用户!',mtError,[mbOk],0)
end;
if (Edit2.Text=Query1mima.Value) then
begin
messagedlg('成功登录',mtInformation,[mbOk],0);
yonghu:=Edit1.Text;
havelogon:=true;
zctform.Show;
havelogon:=True;
tlform.close;
end
else
begin
messageDlg('密码不正确!',mtError,[mbOk],0);
Edit2.Clear ;
Edit2.SetFocus ;
if count=3 then
begin
messageDlg('连续登录三次失败,将退出程序!',mtWarning,[mbOk],0);
Application.Terminate ;
end;
end;
end;
end;
procedure Ttlform.Button2Click(Sender: TObject);
begin
Application.Terminate;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -