Unit5.pas
上传用户:szyozho
上传日期:2013-04-13
资源大小:3688k
文件大小:1k
- unit Unit5;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, Buttons, ExtCtrls, DB, DBTables;
- type
- Tchangemi = class(TForm)
- Image1: TImage;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Edit1: TEdit;
- Edit2: TEdit;
- Edit3: TEdit;
- BitBtn1: TBitBtn;
- BitBtn2: TBitBtn;
- Query2: TQuery;
- Query2ID: TStringField;
- Query2mi: TStringField;
- Query2qx: TStringField;
- procedure BitBtn1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- changemi: Tchangemi;
- implementation
- uses Unit1, Unit3,Unit4;
- {$R *.dfm}
- procedure Tchangemi.BitBtn1Click(Sender: TObject);
- var
- newmi:string;
- begin
- if edit1.text<>mainform.password then
- showmessage('原密码不正确,不能修改密码!')
- else
- if (trim(edit2.text)='') or(trim(edit3.text)='') then
- showmessage('新密码不能为空!')
- else
- if edit2.Text=edit3.Text then
- begin
- newmi:=edit2.text;
- query2.Close;
- Query2.RequestLive := true;
- query2.SQL.Clear;
query2.SQL.text:='update u set mi='''+newmi+''' where ID='''+mainform.username+'''';
query2.ExecSQL;
- //query2.open;
- ShowMessage('密码修改成功!');
- changemi.Close;
- // form3.Enabled:=true;
- //edit1.Text:='';
- //edit2.Text:='';
- //edit3.Text:='';
- end
- else
- begin
- showMessage('新密码和确认密码不一致');
- edit2.Clear;
- edit3.Clear ;
- edit2.SetFocus;
- end;
- end;
- end.