本文整理自网络,侵删。

源码:
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);varMyAdoq: TADOQuery;begintry 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);beginedtadmid3.Clear;edtadmps3.Clear;edtadmps4.Clear;end; end.
来源:https://www.cnblogs.com/ddxxxb/p/6895261.html
相关阅读 >>
Delphi 生成xml 方法 与 Delphi txt文件操作
Delphi fdconnection1 获取数据库总记录数
更多相关阅读请进入《Delphi》频道 >>