passmodify.~pas
来自「一个基于数据的药品行业管理系统,较全面,可供学习数据的开发人员参考消息」· ~PAS 代码 · 共 145 行
~PAS
145 行
unit passmodify;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
Tpasmodify = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure FormActivate(Sender: TObject);
procedure Edit2KeyPress(Sender: TObject; var Key: Char);
procedure Edit3KeyPress(Sender: TObject; var Key: Char);
procedure passwordmodify;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
pasmodify: Tpasmodify;
implementation
uses pubmotion, date1;
{$R *.dfm}
procedure Tpasmodify.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
if edit1.Text<>passwords then
begin
showmessage('原用户密码不对,请重新重新输入');
edit1.SetFocus;
edit1.SelectAll;
exit;
end
else
begin
edit1.Color:=clwindow;
edit2.SetFocus;
edit2.Color:=claqua;
end;
end;
end;
procedure Tpasmodify.FormActivate(Sender: TObject);
begin
edit1.Clear;
edit2.Clear;
edit3.Clear;
edit1.SetFocus;
edit1.Color:=claqua;
end;
procedure Tpasmodify.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
edit2.Color:=clwindow;
edit3.SetFocus;
edit3.Color:=claqua;
end;
end;
procedure Tpasmodify.Edit3KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
if edit2.Text<>edit3.Text then
begin
showmessage('新密码与验证密码不符');
edit2.SelectAll;
edit2.SetFocus;
end;
passwordmodify;
end;
end;
procedure Tpasmodify.passwordmodify;
begin
with data do
begin
aq1.connection:=adoc1;
with aq1 do
begin
close;
sql.Clear;
sql.Add('update czyda set czymm=:czymm');
aq1.Parameters.parambyname('czymm').Value:=trim(edit3.Text);
if messagedlg('确认修改密码吗?',mtinformation,[mbyes,mbno],0)=mrno then
exit;
aq1.ExecSQL;
messagedlg('新密码修改成功',mtinformation,[mbyes],0);
end;
end;
end;
procedure Tpasmodify.Button1Click(Sender: TObject);
begin
close;
end;
procedure Tpasmodify.Button2Click(Sender: TObject);
begin
if edit2.Text='' then
begin
showmessage('新密码不能为空');
edit2.SelectAll;
edit2.SetFocus;
exit;
end;
if edit2.text<>edit3.text then
begin
showmessage('新密码与验证密码不符');
edit2.SelectAll;
edit2.SetFocus;
exit;
end;
passwordmodify;
end;
procedure Tpasmodify.Button3Click(Sender: TObject);
begin
data.pass.close;
close;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?