?? unit11.pas
字號:
unit Unit11;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls, Buttons;
type
TForm11 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Label5: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
ADOQuery1: TADOQuery;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form11: TForm11;
implementation
uses Unit10, Unit1;
{$R *.dfm}
procedure TForm11.BitBtn1Click(Sender: TObject);
begin
if (Edit1.Text='') or (Edit2.Text='') or (Edit3.Text='') or (Edit4.Text='') then
begin
application.MessageBox('信息不完整!','錯誤操作',mb_ok);
exit;
end
else if Edit3.Text<>Edit4.Text then
begin
application.MessageBox('新密碼不匹配!','錯誤操作',mb_ok);
exit;
end
else with dm.Adoquery3 do
begin
close;
sql.Clear;
sql.Add('select * from PW where ID='''+Edit1.Text+'''');
open;
if edit1.text<>dm.adoquery3.fieldbyname('ID').asstring then
application.MessageBox('該用戶名不存在!','錯誤操作',mb_ok)
else if edit2.text<>dm.adoquery3.fieldbyname('PW').asstring then
application.MessageBox('密碼錯誤!','錯誤操作',mb_ok)
else
with dm.Adoquery4 do
begin
close;
sql.Clear;
sql.add('update PW set PW=:pw ');
sql.Add('where ID='''+Edit1.text+'''');
Parameters.ParamByName('pw').Value:=trim(Edit3.Text);
execsql;
application.MessageBox('修改成功!','完成提示',mb_ok);
end;
end;
Edit1.text:='';
Edit2.text:='';
Edit3.text:='';
Edit4.text:='';
end;
procedure TForm11.BitBtn2Click(Sender: TObject);
begin
Form11.Visible:=false;
Form1.show;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -