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

📄 unit7.pas

📁 delphi开发的图书馆管理系统
💻 PAS
字号:
unit Unit7;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, dem, jpeg, ExtCtrls;

type
  TForm7 = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Label2: TLabel;
    Label3: TLabel;
    Image1: TImage;
    Label4: TLabel;
    ComboBox1: TComboBox;
    Label5: TLabel;
    Edit3: TEdit;
    Button4: TButton;
    Button5: TButton;
    procedure Button3Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form7: TForm7;
var
  a:integer=1;
  sql:string;

implementation

{$R *.dfm}

procedure TForm7.Button3Click(Sender: TObject);
begin
close;
end;

procedure TForm7.Button2Click(Sender: TObject);
begin
edit1.Clear;
edit2.Clear;
edit3.Clear;
combobox1.Clear;
end;

procedure TForm7.Button1Click(Sender: TObject);
begin
if a=1 then
begin
if edit1.Text=''then
begin
showmessage('请你输入学号!');
abort;
end;
if edit2.Text=''then
begin
showmessage('请你输入姓名!');
abort;
end;
if combobox1.Text=''then
begin
showmessage('请你选择你的性别!');
abort;
end;
if edit3.Text=''then
begin
showmessage('请你输入系别!');
abort;
end;
dem.dm.conn.Open;
dem.dm.addstudent.Append;
dem.dm.addstudent.FieldByName('sno').AsString:=edit1.Text;
dem.dm.addstudent.FieldByName('sname').AsString:=edit2.Text;
dem.dm.addstudent.FieldByName('sex').AsString:=combobox1.Text;
dem.dm.addstudent.FieldByName('dept').AsString:=edit3.Text;
dem.dm.addstudent.Post;

showmessage('读者信息录入成功!') ;
abort;
end;
if a=2 then
begin
if edit1.Text=''then
begin
showmessage('请你输入学号!');
abort;
end;
if edit2.Text=''then
begin
showmessage('请你输入姓名!');
abort;
end;
dem.dm.query1.Close;
dem.dm.query1.SQL.Clear;
sql:='delete from student where sno='''+edit1.Text+'''';
dem.dm.query1.SQL.Add(sql);
dem.dm.query1.ExecSQL;
showmessage('读者信息注销成功!') ;
end;
end;

procedure TForm7.Button4Click(Sender: TObject);
begin
a:=1;
groupbox1.Caption:='读者信息录入';
groupbox1.Color:=clmoneygreen;

end;

procedure TForm7.Button5Click(Sender: TObject);
begin
a:=2;
groupbox1.Caption:='读者信息注销';
groupbox1.Color:=clfuchsia;
edit1.Clear;
edit2.Clear;
edit3.Clear;

end;

end.

⌨️ 快捷键说明

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