📄 zjyhunit.pas
字号:
unit ZjYhUnit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Buttons, StdCtrls;
type
TZjYhForm = class(TForm)
Label1: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
procedure Edit1Exit(Sender: TObject);
procedure Edit3KeyPress(Sender: TObject; var Key: Char);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
ZjYhForm: TZjYhForm;
implementation
uses PassWordUnit, DataTUnit;
{$R *.DFM}
procedure TZjYhForm.Edit1Exit(Sender: TObject);
begin
if Length(edit1.Text)=0 then
begin
MessageBox(Handle,'口令错误,不能为空,请重输!!!',pchar(caption),mb_iconstop+mb_ok);
edit1.SetFocus;
edit1.SelectAll;
abort;
end;
end;
procedure TZjYhForm.Edit3KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
if (edit3.Text<>edit2.Text) or (Length(edit1.Text)=0) or (Length(edit2.Text)=0) or (Length(edit3.Text)=0) then
begin
MessageBox(Handle,'新口令错误,请重输!!!',pchar(caption),mb_iconstop+mb_ok);
edit3.SetFocus;
edit3.SelectAll;
abort;
end
else
begin
with datat.table3 do
begin
First;
if (Locate('user',edit1.Text,[])) then
begin
MessageBox(0,'用户名重复,请重输!!!',pchar(caption),mb_iconstop+mb_ok);
abort;
end
else
begin
Edit;
Append;
FieldByName('user').AsString:=edit1.Text;
FieldByName('pass').AsString:=edit3.Text;
FieldByName('level').AsString:='普通用户';
post;
MessageBox(0,'成功的增加了用户!!!',pchar(caption),mb_iconinformation+mb_ok);
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
end;
end;
end;
end;
end;
procedure TZjYhForm.SpeedButton2Click(Sender: TObject);
begin
Close;
end;
procedure TZjYhForm.SpeedButton1Click(Sender: TObject);
begin
begin
if (edit3.Text<>edit2.Text) or (Length(edit1.Text)=0) or (Length(edit2.Text)=0) or (Length(edit3.Text)=0) then
begin
MessageBox(Handle,'新口令错误,请重输!!!',pchar(caption),mb_iconstop+mb_ok);
edit3.SetFocus;
edit3.SelectAll;
abort;
end
else
begin
with datat.table3 do
begin
First;
if (Locate('user',edit1.Text,[])) then
begin
MessageBox(0,'用户名重复,请重输!!!',pchar(caption),mb_iconstop+mb_ok);
abort;
end
else
begin
Edit;
Append;
FieldByName('user').AsString:=edit1.Text;
FieldByName('pass').AsString:=edit3.Text;
FieldByName('level').AsString:='普通用户';
post;
MessageBox(0,'成功的增加了用户!!!',pchar(caption),mb_iconinformation+mb_ok);
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
end;
end;
end;
end;
end;
procedure TZjYhForm.FormShow(Sender: TObject);
begin
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
end;
procedure TZjYhForm.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #27 then Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -