Delphi 数据库重置用户密码制作


本文整理自网络,侵删。

 

源码:

unit UUpdateSign;
 
interface
 
uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,Data.Win.ADODB;
 
type
  TFUpdateSign = class(TForm)
    lbl1: TLabel;
    lbl2: TLabel;
    lbl3: TLabel;
    edtadmid3: TEdit;
    edtadmps3: TEdit;
    edtadmps4: TEdit;
    btn1: TButton;
    procedure btn1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  FUpdateSign: TFUpdateSign;
 
implementation
 
{$R *.dfm}
 
uses FDataPool, 日常管理助手;
 
procedure TFUpdateSign.btn1Click(Sender: TObject);
var
MyAdoq: TADOQuery;
begin
try
 MyAdoq:=TADOQuery.create(nil);
 MyAdoq.connection:= frmDataPool.ADOConnection1;
 with MyAdoq do
 begin
   Close;
   SQL.Text:='select * from 用户账号表 where admid = :admid' ;
   Parameters.ParamByName('admid').Value:=edtadmid3.Text;
   Open;
 end;
 if MyAdoq['admps']=null then
 begin
   ShowMessage('您输入的账号不存在,请重新输入');
   Exit;
 end  else if MyAdoq['admps']<>edtadmps3.Text then
 begin
   ShowMessage('原密码不对,请重新输入');
   Exit;
 end;
 
 if edtadmps4.Text <> edtadmps3.text then
  begin
  with MyAdoq do
   begin
     Close;
     SQL.Clear;
     SQL.Text:='update 用户账号表 set admps = '''+edtadmps4.text+''' where admid ='''+edtadmid3.text+''' and admps = '''+edtadmps3.text+'''';
     ExecSQL;
     if MessageDlg('重置成功,是否关闭窗口',mtConfirmation,[mbYes,mbno],0)=mryes then
     Self.Close;
   end;
  end else if edtadmps4.Text = edtadmps3.text then
  begin
    ShowMessage('新密码不可以跟原密码设置一样');
    Exit;
  end;
 
finally
 MyAdoq.Free;
end;
end;
 
procedure TFUpdateSign.FormShow(Sender: TObject);
begin
edtadmid3.Clear;
edtadmps3.Clear;
edtadmps4.Clear;
end;
 
end.

来源:https://www.cnblogs.com/ddxxxb/p/6895261.html

相关阅读 >>

Delphi tnethttpclient https忽略证书验证

Delphi窗体置顶

Delphi 2009 之 tcategorypanelgroup[2]: headeralignment、gradientdirection

Delphi 小数点四舍五入问题

Delphi的format使用总结

Delphi idftp 使用被动连接

Delphi 数据模块池

Delphi 去除右边指定字符

Delphi tfilestream 流操作2

Delphi xe 的 tdictionary

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...