• Delphi(Pascal) 密码修改


    unit PasswordChange;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ADODB, DB, Public_Function, login,Public_Variable;
    
    type
      TForm_PasswordChange = class(TForm)
        grp1: TGroupBox;
        edt2: TEdit;
        edt3: TEdit;
        edt4: TEdit;
        lbl2: TLabel;
        lbl3: TLabel;
        lbl4: TLabel;
        btnAlter: TButton;
        btnclear: TButton;
        btnclose: TButton;
        qryDoQuery1: TADOQuery;
        dsDoDataSet1: TADODataSet;
        procedure btncloseClick(Sender: TObject);
        procedure btnAlterClick(Sender: TObject);
        procedure btnclearClick(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form_PasswordChange: TForm_PasswordChange;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm_PasswordChange.btnAlterClick(Sender: TObject);
    begin
    {edt2 : 旧密码
    edt3 : 新密码
    edt4 : 确认密码}
    (*edt2 : 旧密码
    edt3 : 新密码
    edt4 : 确认密码*)
    if edt2.Text='' then 
    begin application.MessageBox('旧密码不能为空','提示',mb_ok+mb_iconinformation);
    Exit;
    end else if edt3.Text='' then

    begin application.MessageBox('新密码不能为空','提示',mb_ok+mb_iconinformation); Exit; end

    else if edt4.Text='' then begin application.MessageBox('新密码不能为空','提示',mb_ok+mb_iconinformation); exit; end

    else if edt3.Text<>edt4.text then begin application.MessageBox('新密码输入两次不一致','提示',mb_ok+mb_iconinformation); exit;

    end; if(Trim(edt3.Text)=Trim(edt4.Text)) and (edt3.Text<>'') and (edt4.Text<>'') then

    begin qryDoQuery1.Close; qryDoQuery1.Prepared;
    qryDoQuery1.sql.clear; qryDoQuery1.SQL.Add(
    ' select User_ID from Sys_users where User_ID= '''+ Current_user_ID +'''' );
    qryDoQuery1.Open;
    if qryDoQuery1.RecordCount>0 then begin if qryDoQuery1.Fields[0].AsString=Current_user_ID then

    begin qryDoQuery1.Close; qryDoQuery1.Prepared; qryDoQuery1.SQL.Clear;
    qryDoQuery1.SQL.Add(
    'update Sys_users set Psd ='''+ Encode(Edt4.Text) +''' where User_ID='''+ Current_user_ID +'''');
    qryDoQuery1.ExecSQL; ShowMessage(
    '修改成功!'); end else ShowMessage('修改失败!');
    end else showmessage('不能为空!'#13'或者两次密码不正确!!!'); edt2.Clear; edt3.Clear; edt4.Clear;

    end

    end;
    procedure TForm_PasswordChange.btnclearClick(Sender: TObject);
    begin edt2.Clear; edt3.Clear; edt4.Clear;

    end;
    procedure TForm_PasswordChange.btncloseClick(Sender: TObject); begin Self.Close; end; end.
  • 相关阅读:
    MySQL 练习题
    MySQL 增删查改
    HTML显示与隐藏
    360布局
    div布局
    HTML练习2
    HTML练习

    if语句的用法及其案例
    输入输出,数据类型与运算符
  • 原文地址:https://www.cnblogs.com/springcloud/p/15877681.html
Copyright © 2020-2023  润新知