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

📄 static.~pas

📁 中学考试管理系统 采用智能管理 具有统计分析的能力
💻 ~PAS
📖 第 1 页 / 共 3 页
字号:
      numEd.Enabled:=false;
      Label19.Enabled:=false;
      cNumCB.Enabled:=false;
      Label20.Enabled:=true;
      tNumCB.Enabled:=true;
    end;
end;

procedure TForm6.wayCBChange(Sender: TObject);
begin
  if(wayCB.Text='分数段名单') then
    begin
      Label22.Enabled:=true;
      Label23.Enabled:=true;
      Label24.Enabled:=true;
      top.Enabled:=true;
      bottom.Enabled:=true;
    end
  else
    begin
      Label22.Enabled:=false;
      Label23.Enabled:=false;
      Label24.Enabled:=false;
      top.Enabled:=false;
      bottom.Enabled:=false;
    end;
end;

procedure TForm6.TabSheet1Show(Sender: TObject);
var
i:integer;
cNum:String;
begin
  i:=1;
  condCB.Text:='按学号统计';
  Label18.Enabled:=true;
  numEd.Enabled:=true;
  Label19.Enabled:=false;
  cNumCB.Enabled:=false;
  Label20.Enabled:=false;
  tNumCB.Enabled:=false;
  Label22.Enabled:=false;
  Label23.Enabled:=false;
  Label24.Enabled:=false;
  top.Enabled:=false;
  bottom.Enabled:=false;

  optionQry.Close;
  optionQry.SQL.Clear;
  optionQry.SQL.Add('select 课程号, 课程名 from option_course') ;
  optionQRy.Open;
  while(i<=optionQry.RecordCount) do
    begin
      cNum:=optionQry.Fields[0].AsString;
      if(i=1) then
        begin
          cNumCB.Clear;
          cNumCB.Text:=optionQry.Fields[0].AsString;
        end;
       cNumCB.Items.Add(cNum);
       optionQry.Next;
       i:=i+1;
    end;
  i:=1;
  teacherQry.Close;
  teacherQry.SQL.Clear;
  teacherQry.SQL.Add('select 教师编号, 姓名 from teacher');
  teacherQry.Open;
  while(i<=teacherQry.RecordCount) do
    begin
      cNum:=teacherQry.Fields[0].AsString;
      if(i=1) then
        begin
          tNumCB.Clear;
          tNumCB.Text:=teacherQry.Fields[0].AsString;
        end;
       tNumCB.Items.Add(cNum);
       teacherQry.Next;
       i:=i+1;
    end;
end;

procedure TForm6.Button6Click(Sender: TObject);
var
 i,j:integer;
 r:double;
begin
  j:=0;
  staticQry.close;
  staticQry.SQL.Clear;
  if(wayCB.Text='最高分') then
    begin
       if(condCB.text='按学号统计') then
         begin
           staticQry.SQL.Add('select * from optionMark m1 where m1.学号='''+numEd.text+''' and ');
           staticQry.SQL.Add('成绩= (select max(m2.成绩) from optionMark m2 where m2.学号='''+numEd.Text+''')');
         //  showMessage(staticQry.SQL.Text);
           staticQry.Open;
         end
       else if(condCB.text='按课程统计') then
         begin
           staticQry.SQL.Add('select * from optionMark m1 where m1.课程号='''+cNumCB.text+''' and ');
           staticQry.SQL.Add('成绩= (select max(m2.成绩) from optionMark m2 where m2.课程号='''+cNumCB.Text+''')');
         //  showMessage(staticQry.SQL.Text);
           staticQry.Open;
         end
       else if(condCB.text='按任课教师统计') then
         begin
           staticQry.SQL.Add('select * from optionMark m1 where m1.教师编号='''+tNumCB.text+''' and ');
           staticQry.SQL.Add('成绩= (select max(m2.成绩) from optionMark m2 where m2.教师编号='''+tNumCB.Text+''')');
        //   showMessage(staticQry.SQL.Text);
           staticQry.Open;
         end;
    end
  else if(wayCB.Text='最低分') then
    begin
      if(condCB.text='按学号统计') then
         begin
           staticQry.SQL.Add('select * from optionMark m1 where m1.学号='''+numEd.text+''' and ');
           staticQry.SQL.Add('成绩= (select min(m2.成绩) from optionMark m2 where m2.学号='''+numEd.Text+''')');
        //   showMessage(staticQry.SQL.Text);
           staticQry.Open;
         end
       else if(condCB.text='按课程统计') then
         begin
           staticQry.SQL.Add('select * from optionMark m1 where m1.课程号='''+cNumCB.text+''' and ');
           staticQry.SQL.Add('成绩= (select min(m2.成绩) from optionMark m2 where m2.课程号='''+cNumCB.Text+''')');
        //   showMessage(staticQry.SQL.Text);
           staticQry.Open;
         end
       else if(condCB.text='按任课教师统计') then
         begin
           staticQry.SQL.Add('select * from optionMark m1 where m1.教师编号='''+tNumCB.text+''' and ');
           staticQry.SQL.Add('成绩= (select min(m2.成绩) from optionMark m2 where m2.教师编号='''+tNumCB.Text+''')');
        //   showMessage(staticQry.SQL.Text);
           staticQry.Open
         end;
    end
  else if(wayCB.Text='各分数段比率') then
    begin
      edit21.Clear;
      edit22.Clear;
      edit23.Clear;
      edit24.clear;
      edit25.Clear;
      edit26.Clear;
      edit27.Clear;
      edit28.Clear;
      edit29.Clear;
      edit30.Clear;
      if(condCB.text='按学号统计') then
         begin
           nineQry.Close;
           nineQry.SQL.Clear;
           eightQry.close;
           eightQry.SQL.Clear;
           sevenQry.Close;
           sevenQry.SQL.Clear;
           sixQry.Close;
           sixQry.SQL.Clear;
           failQry.Close;
           failQry.SQL.Clear;
           nineQry.SQL.add('select count(*) from  optionMark  where 成绩 >= 90 and 学号='''+numEd.Text+'''');
           eightQry.SQL.add('select count(*) from  optionMark where  成绩 >= 80 and  成绩 < 90  and 学号='''+numEd.Text+'''');
           sevenQry.SQL.add('select count(*) from  optionMark  where  成绩 >= 70 and 成绩 < 80 and 学号='''+numEd.Text+'''');
           sixQry.SQL.add('select count(*) from  optionMark  where 成绩 >= 60 and 成绩 < 70  and 学号='''+numEd.Text+'''');
           failQry.SQL.add('select count(*) from  optionMark  where  成绩 < 60  and 学号='''+numEd.Text+'''');
           staticQry1.close;
           staticQry1.SQL.Clear;
           staticQry1.SQL.Add('select * from optionMark where  学号='''+numEd.Text+'''');
           staticQry1.Open;
           j:=staticQry1.RecordCount;
         end
       else if(condCB.text='按课程统计') then
         begin
           nineQry.Close;
           nineQry.SQL.Clear;
           eightQry.close;
           eightQry.SQL.Clear;
           sevenQry.Close;
           sevenQry.SQL.Clear;
           sixQry.Close;
           sixQry.SQL.Clear;
           failQry.Close;
           failQry.SQL.Clear;
           nineQry.SQL.add('select count(*) from  optionMark  where 成绩 >= 90 and 课程号='''+cNumCB.Text+'''');
           eightQry.SQL.add('select count(*) from  optionMark where  成绩 >= 80 and  成绩 < 90  and 课程号='''+cNumCB.Text+'''');
           sevenQry.SQL.add('select count(*) from  optionMark  where  成绩 >= 70 and 成绩 < 80  and 课程号='''+cNumCB.Text+'''');
           sixQry.SQL.add('select count(*) from  optionMark  where 成绩 >= 60 and 成绩 < 70  and 课程号='''+cNumCB.Text+'''');
           failQry.SQL.add('select count(*) from  optionMark  where  成绩 < 60  and 课程号='''+cNumCB.Text+'''');
           staticQry1.close;
           staticQry1.SQL.Clear;
           staticQry1.SQL.Add('select * from optionMark where 课程号='''+cNumCB.Text+'''');
           staticQry1.Open;
           j:=staticQry1.RecordCount;
         end
       else if(condCB.text='按任课教师统计') then
         begin
           nineQry.Close;
           nineQry.SQL.Clear;
           eightQry.close;
           eightQry.SQL.Clear;
           sevenQry.Close;
           sevenQry.SQL.Clear;
           sixQry.Close;
           sixQry.SQL.Clear;
           failQry.Close;
           failQry.SQL.Clear;
           nineQry.SQL.add('select count(*) from  optionMark  where 成绩 >= 90 and 教师编号='''+tNumCB.Text+'''');
           eightQry.SQL.add('select count(*) from  optionMark where  成绩 >= 80 and  成绩 < 90  and 教师编号='''+tNumCB.Text+'''');
           sevenQry.SQL.add('select count(*) from  optionMark  where  成绩 >= 70 and 成绩 < 80  and 教师编号='''+tNumCB.Text+'''');
           sixQry.SQL.add('select count(*) from  optionMark  where 成绩 >= 60 and 成绩 < 70  and 教师编号='''+tNumCB.Text+'''');
           failQry.SQL.add('select count(*) from  optionMark  where  成绩 < 60 and 教师编号='''+tNumCB.Text+'''');
           staticQry1.close;
           staticQry1.SQL.Clear;
           staticQry1.SQL.Add('select * from optionMark where  教师编号='''+tNumCB.Text+'''');
           staticQry1.Open;
           j:=staticQry1.RecordCount;
         end;
        nineQry.open;
        eightQry.Open;
        sevenQry.Open;
        sixQry.Open;
        failQry.Open;
        Label31.Caption:=inttostr(j);

         if(not((nineQry.Eof)and(eightQry.Eof)and(sevenQry.Eof)and(sixQry.Eof)and(failQry.Eof))) then
          begin
            edit21.Text:=nineQry.Fields[0].AsString;
            i:=strtoint(edit21.Text);
            r:=i/j;
            edit22.Text:=floattostr(r);

            edit23.Text:=eightQry.Fields[0].AsString;
            i:=strtoint(edit23.Text);
            r:=i/j;
            edit24.Text:=floattostr(r);

             edit25.Text:=sevenQry.Fields[0].AsString;
             i:=strtoint(edit25.Text);
             r:=i/j;
             edit26.Text:=floattostr(r);

             edit27.Text:=sixQry.Fields[0].AsString;
             i:=strtoint(edit27.Text);
             r:=i/j;
             edit28.Text:=floattostr(r);

             edit29.Text:=failQry.Fields[0].AsString;
             i:=strtoint(edit29.Text);
             r:=i/j;
             edit30.Text:=floattostr(r);
          end
      else
            showMessage('查询记录为空');
    end
  else if(wayCB.Text='平均分') then
    begin
      staticQry1.Close;
      staticQry1.SQL.Clear;
      if(condCB.text='按学号统计') then
         begin
           staticQry1.SQL.Add('select str(avg(成绩)) from optionMark  where 学号='''+numEd.text+'''');
         //  showMessage(staticQry1.SQL.Text);
           staticQry1.Open;
           avgEd.Text:=staticQry1.Fields[0].AsString;
         end
       else if(condCB.text='按课程统计') then
         begin
           staticQry1.SQL.Add('select str(avg(成绩)) from optionMark  where 课程号='''+cNumCB.text+'''');
        //   showMessage(staticQry1.SQL.Text);
           staticQry1.Open ;
           avgEd.Text:=staticQry1.Fields[0].AsString;
         end
       else if(condCB.text='按任课教师统计') then
         begin
           staticQry1.SQL.Add('select str(avg(成绩)) from optionMark  where 教师编号='''+tNumCB.text+'''');
         //  showMessage(staticQry1.SQL.Text);
           staticQry1.Open;
           avgEd.Text:=staticQry1.Fields[0].AsString;
         end;
    end
  else if(wayCB.Text='分数段名单') then
   begin
    if( (length(top.Text)>0) and (length(bottom.Text)>0) ) then
     if(strtoint(top.Text) < strtoint(bottom.Text)) then
      begin
      if(condCB.text='按学号统计') then
        begin
          staticQry.close;
          staticQry.sql.clear;
          staticQry.sql.add('select * from optionMark where 学号='''+numEd.Text+''' and 成绩 >= '+top.Text+' and 成绩 <= '+bottom.text+'');
       //   showMessage(staticQry.SQL.Text);
          staticQry.Open;
        end
      else if(condCB.text='按课程统计') then
        begin
          staticQry.close;
          staticQry.sql.clear;
          staticQry.sql.add('select * from optionMark where 课程号='''+cNumCB.Text+''' and 成绩 >= '+top.Text+' and 成绩 <= '+bottom.text+'');
        //  showMessage(staticQry.SQL.Text);
          staticQry.Open;
        end
      else if(condCB.text='按任课教师统计') then
        begin
          staticQry.close;
          staticQry.sql.clear;
          staticQry.sql.add('select * from optionMark where 教师编号='''+tNumCB.Text+''' and 成绩 >= '+top.Text+' and 成绩 <= '+bottom.text+'');
         // showMessage(staticQry.SQL.Text);
          staticQry.Open;
        end;
      end
     else
       showMessage('前一空的成绩值必须小于后一空格的成绩值')
    else
      showMessage('请先输入分数段的上下线的成绩值');
    end
  else if (wayCB.Text='排名次') then
    begin
       if(condCB.text='按学号统计') then
        begin
          staticQry.close;
          staticQry.sql.clear;
          staticQry.sql.add('select * from optionMark where 学号='''+numEd.Text+''' order By 成绩');
       //   showMessage(staticQry.SQL.Text);
          staticQry.Open;
        end
      else if(condCB.text='按课程统计') then
        begin
          staticQry.close;
          staticQry.sql.clear;
          staticQry.sql.add('select * from optionMark where 课程号='''+cNumCB.Text+''' order By 成绩');
       //   showMessage(staticQry.SQL.Text);
          staticQry.Open;
        end
      else if(condCB.text='按任课教师统计') then
        begin
          staticQry.close;
          staticQry.sql.clear;
          staticQry.sql.add('select * from optionMark where 教师编号='''+tNumCB.Text+'''  order By 成绩');
        //  showMessage(staticQry.SQL.Text);
          staticQry.Open;
        end;

    end;
end;

end.

⌨️ 快捷键说明

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