?? unit10.pas
字號:
unit Unit10;
//學(xué)生離校處理
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
Tfrm_lixiao = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Label2: TLabel;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_lixiao: Tfrm_lixiao;
implementation
uses Unit13;
{$R *.dfm}
procedure Tfrm_lixiao.Button1Click(Sender: TObject);
begin
if Edit1.Text ='' then
begin
MessageBox(handle,'學(xué)號不能為空!','警告',MB_OK+MB_ICONWARNING);
Edit1.SetFocus ;
exit;
end;
if Edit2.Text ='' then
begin
MessageBox(handle,'姓名不能為空!','警告',MB_OK+MB_ICONWARNING);
Edit2.SetFocus ;
exit;
end;
with data1.ado_stu do
begin
SQL.Clear ;
SQL.Add('select * from 學(xué)生信息 where 學(xué)號='''+Edit1.Text+'''');
Open ;
end;
if data1.ado_stu.Eof then
begin
MessageBox(handle,'錯誤的學(xué)號!','警告',MB_OK+MB_ICONWARNING);
Edit1.SetFocus ;
exit
end;
if data1.ado_stu.FieldByName('姓名').AsString <> trim(Edit2.Text) then
begin
MessageBox(handle,'學(xué)號和姓名不匹配!','警告',MB_OK+MB_ICONWARNING);
Edit1.SetFocus ;
exit;
end;
{
with data1.ado_public do
begin
Close ; //確認(rèn)該學(xué)生是否還有住宿欠費(fèi)
SQL.Clear;
SQL.Add('select * from 學(xué)期注冊 where 學(xué)號='''+Edit1.Text +'''');
Open;
end;
while not data1.ado_public.Eof do
begin
if data1.ado_public.FieldByName('情況').AsString <>'已交清' then
begin
MessageBox(handle,'該學(xué)生有欠費(fèi),不能注銷!','警告',MB_OK+MB_ICONINFORMATION);
exit;
end;
data1.ado_public.Next ;
end;
}
try
with data1.ado_public do
begin
Close; //刪除學(xué)生信息表中的該學(xué)生的信息
SQL.Clear;
SQL.ADD('delete from 學(xué)生信息 where 學(xué)號=:a');
parameters.ParamByName('a').Value:=trim(edit1.Text);
execsql;
end;
application.MessageBox('注銷成功','提示',64);
except
application.MessageBox('注銷失敗','提示',64);
end;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -