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

📄 cjfbunit.pas

📁 高校学生学籍管理系统源码
💻 PAS
字号:
unit cjfbunit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls,datadomule, DB, DBTables;

type
  Tcjfb = class(TForm)
    Bevel1: TBevel;
    Label1: TLabel;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    Label2: TLabel;
    Button1: TButton;
    Label3: TLabel;
    ComboBox3: TComboBox;
    qry: TQuery;
    DataSource1: TDataSource;
    procedure FormCreate(Sender: TObject);
    procedure ComboBox1Exit(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure ComboBox2Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  cjfb: Tcjfb;

implementation

uses cjfbfrmunit;



{$R *.dfm}






procedure Tcjfb.FormCreate(Sender: TObject);

begin
combobox1.Items.clear;
with datamodule1.qry_fplr do
begin
 close;
 sql.clear;
 sql.add('select * from zyb0') ;
 open;
 first;

if recordcount>0 then
// combobox1.text:=Fields[1].asstring;
repeat
 combobox1.items.add(fields[1].asstring);
 until findnext=false;
end;
end;


procedure Tcjfb.ComboBox1Exit(Sender: TObject);
begin
combobox2.Items.Clear;
with datamodule1.qry_fplr do
begin
close;
sql.Clear;
sql.add('select * from bjb0 where zymc=:name');
parambyname('name').asstring:=combobox1.text;
open;
if recordcount>0 then
// combobox2.text:=Fields[0].asstring;
repeat
 combobox2.items.add(fields[0].asstring);
 until findnext=false;
end;
end;

procedure Tcjfb.Button1Click(Sender: TObject);
var a,b,c,d,e,f:integer;
//var i:string;
begin
if (combobox1.text='')or (combobox2.text='') or (combobox3.text='') then
begin
application.messagebox('请输入完整数据,不要留下空白','提示',mb_ok+mb_iconinformation);
exit;
end;


a:=0;
b:=0;
c:=0;
d:=0;
e:=0;
f:=0;
with datamodule1.qry_cjfb do
begin
close;
sql.clear;
sql.Add('select * from cjb0 where bjh0=:id and kcbh=:name');
parambyname('id').asstring:=combobox2.text;
parambyname('name').asstring:=combobox3.text;
open;
first;
while not eof do
begin
//i:=fields[10].asstring;
f:=strtoint(fields[10].asstring);
if f<60 then
begin
a:=a+1;
end;
if (f<70) and (f>=60)  then
begin
b:=b+1;
end;
if (f<80) and (f>=70) then
begin
c:=c+1;
end;
if (f<90) and (f>=80) then
begin
d:=d+1;
end;
if f>=90 then
begin
e:=e+1;
end;
next;
end;
end;
with qry do
begin
close;
sql.Clear ;
sql.add('delete from cjb1');
execsql;
sql.Clear ;
sql.add('select * from cjb1');
open;
edit;

append;
//fields[0].AsString:=combobox2.text;
//fields[1].AsString:=combobox3.text;
fields[0].AsInteger:=a;
fields[1].AsString:='不及格人数';
post;
append;
//fields[0].AsString:=combobox2.text;
//fields[1].AsString:=combobox3.text;
fields[0].AsInteger:=b;
fields[1].AsString:='60到70人数';
 post;
append;
//fields[0].AsString:=combobox2.text;
//fields[1].AsString:=combobox3.text;
fields[0].AsInteger:=c;
fields[1].AsString:='70到80人数';
 post;
append;
//fields[0].AsString:=combobox2.text;
//fields[1].AsString:=combobox3.text;
fields[0].AsInteger:=d;
fields[1].AsString:='80到90人数';
 post;
append;
//fields[0].AsString:=combobox2.text;
//fields[1].AsString:=combobox3.text;
fields[0].AsInteger:=e;
fields[1].AsString:='90到100人数';
post;


end;
cjfbfrm:=tcjfbfrm.create(self);
cjfbfrm.showmodal;
end;


 procedure Tcjfb.ComboBox2Change(Sender: TObject);

begin

combobox3.Items.Clear;
with datamodule1.qry_cjfb do
begin

close;
sql.Clear;
sql.add('select distinct kcbh from cjb0 where bjh0=:name');   //select distinct kcmc from cjb0 where bjh0=:name??????
parambyname('name').asstring:=combobox2.text;
execsql;

active:=true;
if recordcount>0 then
// combobox2.text:=Fields[0].asstring;
repeat
 combobox3.items.add(fields[0].asstring);
 until findnext=false;
end;

end;

end.

⌨️ 快捷键说明

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