u_qscore.pas

来自「大学生综合素质及诚信管理系统可以满足管理人员和高级管理员两方面管理学生综合素质及」· PAS 代码 · 共 126 行

PAS
126
字号
unit u_qscore;

interface

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

type
  Tf_qscore = class(TForm)
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    ComboBox4: TComboBox;
    ComboBox5: TComboBox;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    ADOQuery1: TADOQuery;
    ComboBox6: TComboBox;
    Edit1: TEdit;
    Edit2: TEdit;
    DBGrid1: TDBGrid;
    Label1: TLabel;
    BitBtn4: TBitBtn;
    DataSource1: TDataSource;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  f_qscore: Tf_qscore;

implementation

uses u_print;

{$R *.dfm}

procedure Tf_qscore.BitBtn1Click(Sender: TObject);
var
sqlstr:string;
begin
  sqlstr:=' select * from score where 1=1 ';
 if combobox1.Text='学号' then
  begin
   if combobox2.Text<>'like' then
   sqlstr:=sqlstr+' and stuid '+  combobox2.Text +' ''' + edit1.Text + '''';
   if combobox2.Text='like' then
   sqlstr:=sqlstr+' and stuid like ''%'+edit1.Text+'%''';
  end;
  if combobox1.Text='课程' then
  begin
   if combobox2.Text<>'like' then
   sqlstr:=sqlstr+' and course '+  combobox2.Text +' ''' + edit1.Text + '''';
   if combobox2.Text='like' then
   sqlstr:=sqlstr+' and course like ''%'+edit1.Text+'%''';
  end;
  if combobox1.Text='成绩' then
  begin
   if combobox2.Text<>'like' then
   sqlstr:=sqlstr+' and score '+  combobox2.Text +' ''' + edit1.Text + '''';
   if combobox2.Text='like' then
   sqlstr:=sqlstr+' and score like ''%'+edit1.Text+'%''';

  end;
  if combobox1.Text='类型' then
  begin
   if combobox2.Text<>'like' then
   sqlstr:=sqlstr+' and type '+  combobox2.Text +' ''' + edit1.Text + '''';
   if combobox2.Text='like' then
   sqlstr:=sqlstr+' and type like ''%'+edit1.Text+'%''';
  end;
 if combobox4.Text<>'' then
  begin
  if combobox5.Text='学号' then
  begin
   if combobox6.Text<>'like' then
      sqlstr:=sqlstr+ combobox4.Text+'  stuid'+ combobox6.Text+''''+edit2.Text+'''';
   if combobox6.Text='like' then
      sqlstr:=sqlstr+ combobox4.Text+'  stuid like ''%'+edit2.Text+'%''';
  end;
  if combobox5.Text='课程' then
  begin
   if combobox6.Text<>'like' then
      sqlstr:=sqlstr+ combobox4.Text+' course '+ combobox6.Text+''''+edit2.Text+'''';
   if combobox6.Text='like' then
      sqlstr:=sqlstr+ combobox4.Text+'  course like ''%'+edit2.Text+'%''';
  end;
  if combobox5.Text='成绩' then
  begin
   if combobox6.Text<>'like' then
      sqlstr:=sqlstr+ combobox4.Text+' score '+ combobox6.Text+''''+edit2.Text+'''';
   if combobox6.Text='like' then
      sqlstr:=sqlstr+ combobox4.Text+' score like ''%'+edit2.Text+'%''';
  end;
  if combobox5.Text='类型' then
  begin
   if combobox6.Text<>'like' then
      sqlstr:=sqlstr+ combobox4.Text+'  type'+ combobox6.Text+''''+edit2.Text+'''';
   if combobox6.Text='like' then
      sqlstr:=sqlstr+ combobox4.Text+'  type like ''%'+edit2.Text+'%''';
  end;
  end;
 
  adoquery1.Close;
  adoquery1.SQL.Clear;
  adoquery1.SQL.Add(sqlstr);
  adoquery1.Open;
end;

procedure Tf_qscore.BitBtn2Click(Sender: TObject);
begin
close;
end;

procedure Tf_qscore.BitBtn4Click(Sender: TObject);
begin
f_print.QuickRep1.Preview;
end;

end.

⌨️ 快捷键说明

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