📄 card_lost.pas
字号:
unit card_lost;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls, Buttons, ExtCtrls;
type
Tcardlost = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Edit1: TEdit;
Label2: TLabel;
GroupBox2: TGroupBox;
Label3: TLabel;
Edit2: TEdit;
Label4: TLabel;
ADOCommand1: TADOCommand;
ADOQuery1: TADOQuery;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
Image1: TImage;
// procedure Button1Click(Sender: TObject);
// procedure Button2Click(Sender: TObject);
// procedure Button3Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
cardlost: Tcardlost;
implementation
uses browse;
{$R *.dfm}
procedure Tcardlost.BitBtn1Click(Sender: TObject);
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select* from [user] where StuID='''+Edit1.Text+'''';
adoquery1.Open;
if (Edit1.Text='')or(adoquery1.FieldByName('StuID').asstring='') then
begin
showmessage('请输入正确的用户帐号!');
Edit1.Text:='';
end
else
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select Symbol from [user] where StuID='''+Edit1.Text+'''';
adoquery1.Open;
if adoquery1.FieldByName('Symbol').Asinteger = 0 then
begin
showmessage('已挂失!');
end
else
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select StuID from [user] where StuID='''+Edit1.Text+'''';
adoquery1.Open;
if adoquery1.FieldByName('StuID').AsString <> '' then
begin
adocommand1.CommandText:='update [user] set Symbol=0 where StuID='''+Edit1.Text+'''';
adocommand1.Execute;
showmessage('挂失成功!');
//close;
end
end;
end;
end;
procedure Tcardlost.BitBtn2Click(Sender: TObject);
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select* from [user] where StuID='''+Edit2.Text+'''';
adoquery1.Open;
if (Edit2.Text='')or(adoquery1.FieldByName('StuID').asstring='') then
//if Edit2.Text='' then
begin
showmessage('请输入正确的用户帐号!');
Edit2.Text:='';
end
else
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select Symbol from [user] where StuID='''+Edit2.Text+'''';
adoquery1.Open;
if adoquery1.FieldByName('Symbol').Asinteger = 1 then
begin
showmessage('未挂失!');
end
else
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select StuID from [user] where StuID='''+Edit2.Text+'''';
adoquery1.Open;
if adoquery1.FieldByName('StuID').AsString <> '' then
begin
adocommand1.CommandText:='update [user] set Symbol=1 where StuID='''+Edit2.Text+'''';
adocommand1.Execute;
showmessage('解除挂失成功!');
// close;
end
end;
end;
end;
procedure Tcardlost.BitBtn3Click(Sender: TObject);
begin
close;
end;
procedure Tcardlost.FormShow(Sender: TObject);
begin
Edit1.text:='';
Edit2.text:='';
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -