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

📄 cha1.pas

📁 本人集结心血制作的delphi版学生信息管理系统
💻 PAS
字号:
unit cha1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, ADODB, StdCtrls, Grids, DBGrids;

type
  TForm7 = class(TForm)
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    CheckBox7: TCheckBox;
    CheckBox3: TCheckBox;
    ComboBox3: TComboBox;
    ComboBox4: TComboBox;
    DBGrid1: TDBGrid;
    Edit1: TEdit;
    Button1: TButton;
    Edit2: TEdit;
    ADOConnection1: TADOConnection;
    DataSource1: TDataSource;
    ADOQuery1: TADOQuery;
    CheckBox4: TCheckBox;
    ComboBox2: TComboBox;
    CheckBox5: TCheckBox;
    ComboBox1: TComboBox;
    CheckBox8: TCheckBox;
    ComboBox5: TComboBox;
    procedure CheckBox1Click(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure CheckBox5Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form7: TForm7;

implementation

{$R *.dfm}

procedure TForm7.CheckBox1Click(Sender: TObject);
begin
if checkbox1.Checked then
begin

    CheckBox2.Enabled:=false;
    CheckBox5.Enabled:=false;
    CheckBox7.Enabled:=false;
    CheckBox8.Enabled:=false;
    CheckBox3.Enabled:=false;
    CheckBox4.Enabled:=false;
    ComboBox1.Enabled:=false;
    ComboBox2.Enabled:=false;
    ComboBox3.Enabled:=false;
    ComboBox4.Enabled:=false;
    ComboBox5.Enabled:=false;
    Edit2.Enabled:=false;
    CheckBox2.Checked:=false;
    CheckBox5.Checked:=false;
    CheckBox7.Checked:=false;
    CheckBox8.Checked:=false;
    CheckBox3.Checked:=false;
    CheckBox4.Checked:=false;
    end
    else
    begin
    edit1.Text:='';
    edit1.Enabled:=false;
    CheckBox2.Enabled:=true;
    CheckBox5.Enabled:=true;
    CheckBox7.Enabled:=true;
    CheckBox8.Enabled:=true;
    CheckBox3.Enabled:=true;
    CheckBox4.Enabled:=true;
    ComboBox1.Enabled:=true;
    ComboBox2.Enabled:=true;
    ComboBox3.Enabled:=true;
    ComboBox4.Enabled:=true;
    ComboBox5.Enabled:=true;
    Edit2.Enabled:=true;
     end;

end;

procedure TForm7.ComboBox1Change(Sender: TObject);
begin
case combobox1.ItemIndex of
0:
begin
combobox2.items.Clear;
combobox2.Items.Add('电气工程及其自动化');
combobox2.Items.Add('自动化');
combobox2.Items.Add('电子信息工程');
combobox2.Items.Add('电子信息与科学');
end;
1:
begin
combobox2.items.Clear;
combobox2.Items.Add('计算机科学与技术');
combobox2.Items.Add('通信工程');
combobox2.Items.Add('计算机科学与技术(专升本)');
end;
2:
begin
combobox2.items.Clear;
combobox2.Items.Add('机械设计制造及其自动化');
combobox2.Items.Add('材料成型及控制工程');
combobox2.Items.Add('工业设计');
combobox2.Items.Add('热能与动力工程');
end;
3:
begin
combobox2.items.Clear;
combobox2.Items.Add('建筑学');
combobox2.Items.Add('土木工程');
combobox2.Items.Add('工程管理');
combobox2.Items.Add('土木工程(专升本)');
end;
4:
begin
combobox2.items.Clear;
combobox2.Items.Add('地质工程');
combobox2.Items.Add('环境工程');
combobox2.Items.Add('地理信息系统');
combobox2.Items.Add('地质工程(专升本)');
end;
5:
begin
combobox2.items.Clear;
combobox2.Items.Add('测绘工程');
combobox2.Items.Add('土地资源管理');
combobox2.Items.Add('资源环境与城乡规划管理');
end;
6:
begin
combobox2.items.Clear;
combobox2.Items.Add('采矿工程');
combobox2.Items.Add('安全工程');
combobox2.Items.Add('材料科学与工程');
combobox2.Items.Add('矿物加工工程');
combobox2.Items.Add('工业工程');
end;
7:
begin
combobox2.items.Clear;
combobox2.Items.Add('数学与应用数学');
combobox2.Items.Add('信息与计算科学');
end;
8:
begin
combobox2.items.Clear;
combobox2.Items.Add('工商管理');
combobox2.Items.Add('会计学');
combobox2.Items.Add('人力资源管理');
combobox2.Items.Add('国际经济与贸易');
end;
9:
begin
combobox2.items.Clear;
combobox2.Items.Add('法学');
combobox2.Items.Add('公共事业管理');
combobox2.Items.Add('艺术设计');
end;
10:
begin
combobox2.items.Clear;
combobox2.Items.Add('英语');
end;

end;
end;

procedure TForm7.Button1Click(Sender: TObject);
var
xuanze : string;
first:integer;
begin
first:=1;
xuanze:='select distinct 学籍.学籍号,姓名,性别,生日,院系,专业,年级,班级,民族,籍贯 from 学籍,选课 where ';

adoquery1.Active:=false;
adoquery1.SQL.Clear;

if checkbox1.Checked then
xuanze:='select 学籍号,姓名,性别,生日,院系,专业,年级,班级,民族,籍贯 from 学籍 where '+'学籍.学籍号='''+edit1.text+'''' ;





if checkbox5.Checked then
if (first=1) then
  begin
xuanze:=xuanze+'院系='''+combobox1.text+'''' ;
 first:=0;
 end
else
xuanze:=xuanze+' and 院系='''+combobox1.text+'''';


if checkbox3.Checked then
if (first=1) then
  begin
xuanze:=xuanze+'年级='''+combobox3.text+'''' ;
 first:=0;
 end
else
xuanze:=xuanze+' and 年级='''+combobox3.text+'''';


if checkbox2.Checked then
if (first=1) then
  begin
xuanze:=xuanze+'姓名='''+edit2.text+'''' ;
 first:=0;
 end
else
xuanze:=xuanze+' and 姓名='''+edit2.text+'''';

if checkbox4.Checked then
if (first=1) then
  begin
xuanze:=xuanze+'专业='''+combobox2.text+'''' ;
 first:=0;
 end
else
xuanze:=xuanze+' and 专业='''+combobox2.text+'''';


if checkbox7.Checked then
if (first=1) then
  begin
xuanze:=xuanze+'班级='''+combobox4.text+'''' ;
 first:=0;
 end
else
xuanze:=xuanze+' and 班级='''+combobox4.text+'''';

if checkbox8.Checked then
if (first=1) then
  begin
xuanze:=xuanze+' 学籍.学籍号=选课.学籍号 and 选课.选课='''+combobox5.Text+'''';
 first:=0;
 end
else
xuanze:=xuanze+' and 学籍.学籍号=选课.学籍号 and 选课.选课='''+combobox5.Text+'''';

adoquery1.SQL.Add(xuanze);
adoquery1.Open;

end;

procedure TForm7.CheckBox5Click(Sender: TObject);
begin
checkbox4.Visible:=true;
combobox2.Visible:=true;
end;

end.

⌨️ 快捷键说明

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