⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modifypsw.pas

📁 老年人大学的学籍管理,主要是学费收取
💻 PAS
字号:
unit modifypsw;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, base, ExtCtrls, SUIForm, SUIButton, StdCtrls, SUIEdit;

type
  Tfrmpassword = class(Tbaseform)
    edtold: TsuiEdit;
    edtnew: TsuiEdit;
    edtnew2: TsuiEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    suiButton1: TsuiButton;
    suiButton2: TsuiButton;
    procedure suiButton1Click(Sender: TObject);
    procedure suiButton2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmpassword: Tfrmpassword;

implementation

uses pub, umain, adodb, ulogin;

{$R *.dfm}

procedure Tfrmpassword.suiButton1Click(Sender: TObject);
var tmp:tadoquery;
begin
  inherited;
  if trim(edtnew.Text)<>trim(edtnew2.Text) then
    begin
    application.MessageBox('两次输入的密码不一致!','提示',mb_ok+mb_iconinformation);
    exit;
    end;
  if trim(edtnew.Text)='' then
    begin
    application.MessageBox('新密码不能为空!','提示',mb_ok+mb_iconinformation);
    exit;
    end;
  tmp:=tadoquery.Create(nil);
  tmp.ConnectionString:=frmmain.adc.ConnectionString;
  with tmp do
    begin
    sql.Clear;
    sql.Add('select * from users where username='+''''+frmmain.user+'''');
    //showmessage(sql.Text);
    open;
    end;
  //pub.showrecord(tmp,'*','users where username='+frmlogin.username,'id');
  if tmp.FieldByName('userpassword').AsString<>trim(edtold.Text) then
    begin
    application.MessageBox('原密码不正确!','提示',mb_ok+mb_iconinformation);
    tmp.Free;
    exit;
    end;
  frmmain.adc.BeginTrans;
  try
    with tmp do
      begin
      sql.Clear;
      sql.Add('update users set userpassword='+''''+trim(edtnew.Text)+''''+' where username='+''''+frmmain.user+'''');
      //showmessage(sql.Text);
      execsql
      end;
    frmmain.adc.CommitTrans;
    application.MessageBox('密码修改成功!','提示',mb_ok+mb_iconinformation);
    tmp.Free;
    close;
  except
    frmmain.adc.RollbackTrans;
    application.MessageBox('密码修改失败!','警告',mb_ok+mb_iconwarning);
    tmp.Free;
  end;
end;

procedure Tfrmpassword.suiButton2Click(Sender: TObject);
begin
  inherited;
  close;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -