?? pwd.pas
字號:
unit pwd;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, StdCtrls, Buttons, Mask, ADODB;
type
TF_pwd = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
MaskEdit1: TMaskEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label4: TLabel;
MaskEdit2: TMaskEdit;
MaskEdit3: TMaskEdit;
L_login: TLabel;
ADOQuery1: TADOQuery;
procedure FormShow(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
F_pwd: TF_pwd;
implementation
uses main;
{$R *.dfm}
procedure TF_pwd.FormShow(Sender: TObject);
var tablename,loginname:string;
begin
l_login.Caption :=vloginname;
adoquery1.SQL.clear;
if vloginstatus='管理員' then
begin
tablename:='admin';
loginname:='login';
end;
if vloginstatus='教師' then
begin
tablename:='teacher';
loginname:='teacherno';
end;
if vloginstatus='學生' then
begin
tablename:='student';
loginname:='studentno';
end;
adoquery1.sql.Add('select name,password from '+tablename+' where '+loginname+'='''+vlogin+''' ');
adoquery1.Open;
end;
procedure TF_pwd.BitBtn2Click(Sender: TObject);
begin
F_pwd.Close ;
end;
procedure TF_pwd.BitBtn1Click(Sender: TObject);
var tablename,loginname:string;
begin
if maskedit1.Text <>adoquery1.FieldByName('password').AsString then
begin
showmessage('原密碼輸入不正確!');
exit;
end;
if maskedit2.Text <> maskedit3.Text then
begin
showmessage('兩次輸入的密碼不一致!');
exit;
end;
adoquery1.sql.Clear;
if vloginstatus='管理員' then
begin
tablename:='admin';
loginname:='login';
end;
if vloginstatus='教師' then
begin
tablename:='teacher';
loginname:='teacherno';
end;
if vloginstatus='學生' then
begin
tablename:='student';
loginname:='studentno';
end;
adoquery1.sql.Add('update '+tablename+' set password='''+maskedit2.Text+''' where '+loginname+'='''+vlogin+''' ');
adoquery1.ExecSQL ;
F_pwd.Close ;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -