code.pas

来自「利用Delphi6.0和MS Server2000为主要开发工具」· PAS 代码 · 共 82 行

PAS
82
字号
unit code;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons;

type
  TFm_code = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Label3: TLabel;
    Edit3: TEdit;
    Button1: TButton;
    Edit2: TEdit;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Fm_code: TFm_code;

implementation

uses data;

var
sta:boolean;

{$R *.dfm}

procedure TFm_code.Button1Click(Sender: TObject);
begin
if sta=false then
begin
   if ((edit1.Text='') or (edit1.Text=null)) then
   application.MessageBox('请输入图书证号','输入错误',
                     mb_iconinformation + mb_defbutton1);
   if ((edit2.Text='') or (edit2.Text=null)) then
   application.MessageBox('请输入密码','输入错误',
                     mb_iconinformation + mb_defbutton1);
   if  ((edit3.text='') or (edit2.text=null)) then
   application.MessageBox('请输入新密码','输入错误',
                     mb_iconinformation + mb_defbutton1);
   fm_data.Cd_card.Close;
   fm_data.Cd_card.CommandText:='select * from cards where cardNo='+edit1.Text+' and code='+edit2.text;
   fm_data.Cd_card.Execute;
   fm_data.Cd_card.Open;

   if fm_data.Cd_card.RecordCount>0 then
   begin
       fm_data.Cd_card.Edit;
       fm_data.Cd_card.fieldbyname('code').Value:=edit3.Text;
       fm_data.Cd_card.ApplyUpdates(-1);
       showmessage('密码修改成功');
   end
   else
      showmessage('图书证或密码有错误');
end;

end;

procedure TFm_code.FormCreate(Sender: TObject);
begin
sta:=false;
end;

procedure TFm_code.Button2Click(Sender: TObject);
begin
close;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?