⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit10.pas

📁 delphi+sql2005做的一个宿舍管理系统源码,初学者,所以比较简单,后面有个查询功能还没完成,希望能给大家一个参考
💻 PAS
字号:
unit Unit10;
//学生离校处理
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,'学号不能为空!','警告',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 学生信息 where 学号='''+Edit1.Text+'''');
    Open ;
  end;
if data1.ado_stu.Eof  then
  begin
     MessageBox(handle,'错误的学号!','警告',MB_OK+MB_ICONWARNING);
     Edit1.SetFocus ;
     exit
  end;
if  data1.ado_stu.FieldByName('姓名').AsString <> trim(Edit2.Text) then
  begin
     MessageBox(handle,'学号和姓名不匹配!','警告',MB_OK+MB_ICONWARNING);
     Edit1.SetFocus ;
     exit;
  end;
{
with data1.ado_public do
  begin
   Close ;    //确认该学生是否还有住宿欠费
   SQL.Clear;
   SQL.Add('select * from 学期注册 where 学号='''+Edit1.Text +'''');
   Open;
  end;
while not data1.ado_public.Eof do
  begin
    if data1.ado_public.FieldByName('情况').AsString <>'已交清' then
      begin
        MessageBox(handle,'该学生有欠费,不能注销!','警告',MB_OK+MB_ICONINFORMATION);
        exit;
      end;
    data1.ado_public.Next ;
  end;
}
try
with data1.ado_public do
  begin
    Close;       //删除学生信息表中的该学生的信息
    SQL.Clear;
    SQL.ADD('delete from 学生信息 where 学号=:a');
    parameters.ParamByName('a').Value:=trim(edit1.Text);
    execsql;
  end;
  application.MessageBox('注销成功','提示',64);
except
  application.MessageBox('注销失败','提示',64);
end;
end;
end.

⌨️ 快捷键说明

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