< SQL SERVER 2000 案例教程>>,冶金工业出版社,这本书的代码

源代码在线查看: unit6.pas

软件大小: 5514 K
上传用户: a415834839
关键词: SERVER 2000 gt SQL
下载地址: 免注册下载 普通下载 VIP

相关代码

				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;
				          //编写进行更新用户密码表的SQL语句
				          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.
							

相关资源