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

📄 unit7.~pas

📁 成绩管理系统 主要实现:学生(学号
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
unit Unit7;

interface

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

type
  TForm7 = class(TForm)
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    GroupBox3: TGroupBox;
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    DBGrid1: TDBGrid;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    ComboBox1: TComboBox;
    Button5: TButton;
    Button6: TButton;
    Button7: TButton;
    ComboBox2: TComboBox;
    Button8: TButton;
    DataSource1: TDataSource;
    ADOQuery1: TADOQuery;
    procedure Button8Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form7: TForm7;

implementation
 uses Unit1;
{$R *.dfm}

procedure TForm7.Button8Click(Sender: TObject);
begin
     form7.Close;
end;

procedure TForm7.Button1Click(Sender: TObject);
begin
     if Edit1.text=''then
          showmessage('学号/班号不能够为空!')
     else
          begin
               if Edit2.Text='' then
                   showmessage('课程号不能够为空!')
                else
                    begin
                         adoquery1.Close;
                         adoquery1.SQL.Clear;
                         adoquery1.SQL.Add('select cour_no from courses where cour_no='''+Edit2.Text+'''');
                         adoquery1.Open;
                         if adoquery1.RecordCount=0 then
                              showmessage('没有该课程号的记录!')
                         else
                              begin
                                   adoquery1.Close;
                                   adoquery1.SQL.Clear;
                                   adoquery1.SQL.Add('select cour_no from stud_score where cour_no='''+Edit2.Text+'''');
                                   adoquery1.Open;
                                   if adoquery1.RecordCount=0 then
                                            showmessage('该课程号还没有相关的成绩记录!')
                                    else
                                        begin
                                             adoquery1.Close;
                                             adoquery1.SQL.Clear;
                                             adoquery1.SQL.Add('select avg(score) as"平均成绩" from stud_score where stu_no');
                                             adoquery1.SQL.Add('in(select stu_no from student where stu_class='''+Edit1.Text+''')');
                                             adoquery1.Open;
                                             if adoquery1.RecordCount=0then
                                                 showmessage('学号:'''+Edit1.Text+'''课程号:'''+Edit2.Text+'''没有相关的成绩记录')
                                             else  showmessage('相关记录如表!')
                                         end
                              end
                    end
          end
end;

procedure TForm7.Button2Click(Sender: TObject);
begin

      if Edit1.text=''then
          showmessage('学号/班号不能够为空!')
     else
          begin
               if Edit2.Text='' then
                   showmessage('课程号不能够为空!')
                else
                    begin
                         adoquery1.Close;
                         adoquery1.SQL.Clear;
                         adoquery1.SQL.Add('select cour_no from courses where cour_no='''+Edit2.Text+'''');
                         adoquery1.Open;
                         if adoquery1.RecordCount=0 then
                              showmessage('没有该课程号的记录!')
                         else
                              begin
                                   adoquery1.Close;
                                   adoquery1.SQL.Clear;
                                   adoquery1.SQL.Add('select cour_no from stud_score where cour_no='''+Edit2.Text+'''');
                                   adoquery1.Open;
                                   if adoquery1.RecordCount=0 then
                                            showmessage('该课程号还没有相关的成绩记录!')
                                    else
                                          begin
                                               if ComboBox1.Text='60以下' then  begin
                                                adoquery1.Close;
                                                adoquery1.SQL.Clear;
                                                adoquery1.SQL.Add('select count(stu_no) as"人数" from stud_score where 0<score and score<=60 and stu_no');
                                                adoquery1.SQL.Add('in(select distinct stu_no from student where stu_class='''+Edit1.Text+''')');      //有问题
                                                adoquery1.Open;end
                                               else
                                                    begin
                                                         if ComboBox1.Text='60以上' then  begin
                                                          adoquery1.Close;
                                                          adoquery1.SQL.Clear;
                                                          adoquery1.SQL.Add('select count(stu_no) as"人数" from stud_score where 60<score and score<=100 and stu_no');
                                                          adoquery1.SQL.Add('in(select distinct stu_no from student where stu_class='''+Edit1.Text+''')');      //有问题
                                                          adoquery1.Open;end
                                                         else
                                                             begin
                                                                 if ComboBox1.Text='60-69' then  begin
                                                                   adoquery1.Close;
                                                                   adoquery1.SQL.Clear;
                                                                   adoquery1.SQL.Add('select count(stu_no) as"人数" from stud_score where 60<score and score<=69 and stu_no');

⌨️ 快捷键说明

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