unit6.~pas
来自「是关于SQL的一些程序 很好很经典的~大家又兴趣的可以学习下」· ~PAS 代码 · 共 79 行
~PAS
79 行
unit Unit6;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TchangepasswordForm = class(TForm)
confirm: TEdit;
Label1: TLabel;
newpassword: TEdit;
Label2: TLabel;
oldpassword: TEdit;
Label3: TLabel;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
changepasswordForm: TchangepasswordForm;
implementation
{$R *.dfm}
uses unit2,unit1;
procedure TchangepasswordForm.Button1Click(Sender: TObject);
begin
//判断原密码是否正确,
with mydata.Query1 do
begin
close;
with sql do
begin
clear;
add('select * from 用户密码表 where 用户名=:name');
ParamByName('name').AsString:=trim(login.Edit1.Text);
end;
open;
if (trim(oldpassword.Text)=trim(FieldByName('用户密码').AsString)) then
begin
if trim(newpassword.Text)=trim(confirm.Text) then
begin
close;
with sql do
begin
clear;
add('Update 用户密码表 set 用户密码=:password where 用户名=:username');
ParamByname('username').AsString:=trim(login.Edit1.Text);
ParamByName('password').AsString:=trim(confirm.Text);
end;
execsql;
showmessage('修改密码成功');
changepasswordform.Close;
end else
begin
showmessage('新密码输入不一致');
end;
end else
begin
showmessage('旧密码输入不正确');
end;
end;
end;
procedure TchangepasswordForm.Button2Click(Sender: TObject);
begin
close;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?