📄 u_chaxun.pas
字号:
unit U_chaxun;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls, Buttons;
type
Tf_chaxun = class(TForm)
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
ComboBox3: TComboBox;
ComboBox4: TComboBox;
ComboBox5: TComboBox;
ComboBox6: TComboBox;
ComboBox7: TComboBox;
ComboBox8: TComboBox;
ComboBox9: TComboBox;
ComboBox10: TComboBox;
ComboBox11: TComboBox;
ComboBox12: TComboBox;
ComboBox13: TComboBox;
ComboBox14: TComboBox;
ComboBox15: TComboBox;
ComboBox16: TComboBox;
ComboBox17: TComboBox;
ComboBox18: TComboBox;
ComboBox19: TComboBox;
ADOQuery1: TADOQuery;
Label1: TLabel;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
f_chaxun: Tf_chaxun;
implementation
uses U_chaxunxianshi;
{$R *.dfm}
procedure Tf_chaxun.BitBtn1Click(Sender: TObject);
var
sqlstr:string;
begin
sqlstr:=' select a.*,b.* from stuinfo a left join student b on a.stuid=b.stuid ';
sqlstr:=sqlstr+' where 1=1 ';
if combobox1.Text='学号' then
begin
if combobox2.Text<>'like' then
sqlstr:=sqlstr+' and a.stuid '+ combobox2.Text +' ''' + combobox3.Text + '''';
if combobox2.Text='like' then
sqlstr:=sqlstr+' and a.stuid like ''%'+combobox3.Text+'%''';
end;
if combobox1.Text='姓名' then
begin
if combobox2.Text<>'like' then
sqlstr:=sqlstr+' and stuname '+ combobox2.Text +' ''' + combobox3.Text + '''';
if combobox2.Text='like' then
sqlstr:=sqlstr+' and stuname like ''%'+combobox3.Text+'%''';
end;
if combobox1.Text='性别' then
begin
if combobox2.Text<>'like' then
sqlstr:=sqlstr+' and stusex '+ combobox2.Text +' ''' + combobox3.Text + '''';
if combobox2.Text='like' then
sqlstr:=sqlstr+' and stusex like ''%'+combobox3.Text+'%''';
end;
if combobox1.Text='生日' then
begin
if combobox2.Text<>'like' then
sqlstr:=sqlstr+' and stubirthday '+ combobox2.Text +' ''' + combobox3.Text + '''';
if combobox2.Text='like' then
sqlstr:=sqlstr+' and stubirthday like ''%'+combobox3.Text+'%''';
end;
if combobox1.Text='班级' then
begin
if combobox2.Text<>'like' then
sqlstr:=sqlstr+' and stuclass '+ combobox2.Text +' ''' + combobox3.Text + '''';
if combobox2.Text='like' then
sqlstr:=sqlstr+' and stuclass like ''%'+combobox3.Text+'%''';
end;
if combobox1.Text='系别' then
begin
if combobox2.Text<>'like' then
sqlstr:=sqlstr+' and studepart '+ combobox2.Text +' ''' + combobox3.Text + '''';
if combobox2.Text='like' then
sqlstr:=sqlstr+' and studepart like ''%'+combobox3.Text+'%''';
end;
if combobox1.Text='籍贯' then
begin
if combobox2.Text<>'like' then
sqlstr:=sqlstr+' and stujiguan '+ combobox2.Text +' ''' + combobox3.Text + '''';
if combobox2.Text='like' then
sqlstr:=sqlstr+' and stujiguan like ''%'+combobox3.Text+'%''';
end;
if combobox1.Text='奖励、惩罚、变更' then
begin
if combobox2.Text<>'like' then
sqlstr:=sqlstr+' and stucontent '+ combobox2.Text +' ''' + combobox3.Text + '''';
if combobox2.Text='like' then
sqlstr:=sqlstr+' and stucontent like ''%'+combobox3.Text+'%''';
end;
if combobox1.Text='奖励、惩罚、变更日期' then
begin
if combobox2.Text<>'like' then
sqlstr:=sqlstr+' and date '+ combobox2.Text +' ''' + combobox3.Text + '''';
if combobox2.Text='like' then
sqlstr:=sqlstr+' and date like ''%'+combobox3.Text+'%''';
end;
if combobox5.Text='学号' then
begin
if combobox6.Text<>'like' then
sqlstr:=sqlstr+ combobox4.Text+' a.stuid'+ combobox6.Text+''''+combobox7.Text+'''';
if combobox6.Text='like' then
sqlstr:=sqlstr+ combobox4.Text+' a.stuid like ''%'+combobox7.Text+'%''';
end;
if combobox5.Text='姓名' then
begin
if combobox6.Text<>'like' then
sqlstr:=sqlstr+ combobox4.Text+' stuname'+ combobox6.Text+''''+combobox7.Text+'''';
if combobox6.Text='like' then
sqlstr:=sqlstr+ combobox4.Text+' stuname like ''%'+combobox7.Text+'%''';
end;
if combobox5.Text='姓别' then
begin
if combobox6.Text<>'like' then
sqlstr:=sqlstr+ combobox4.Text+' stuname'+ combobox6.Text+''''+combobox7.Text+'''';
if combobox6.Text='like' then
sqlstr:=sqlstr+ combobox4.Text+' stuname like ''%'+combobox7.Text+'%''';
end;
if combobox5.Text='生日' then
begin
if combobox6.Text<>'like' then
sqlstr:=sqlstr+ combobox4.Text+' stubirthday'+ combobox6.Text+''''+combobox7.Text+'''';
if combobox6.Text='like' then
sqlstr:=sqlstr+ combobox4.Text+' stubirthday like ''%'+combobox7.Text+'%''';
end;
if combobox5.Text='班级' then
begin
if combobox6.Text<>'like' then
sqlstr:=sqlstr+ combobox4.Text+' stuclass'+ combobox6.Text+''''+combobox7.Text+'''';
if combobox6.Text='like' then
sqlstr:=sqlstr+ combobox4.Text+' stuclass like ''%'+combobox7.Text+'%''';
end;
if combobox5.Text='系别' then
begin
if combobox6.Text<>'like' then
sqlstr:=sqlstr+ combobox4.Text+' studepart'+ combobox6.Text+''''+combobox7.Text+'''';
if combobox6.Text='like' then
sqlstr:=sqlstr+ combobox4.Text+' studepart like ''%'+combobox7.Text+'%''';
end;
if combobox5.Text='籍贯' then
begin
if combobox6.Text<>'like' then
sqlstr:=sqlstr+ combobox4.Text+' stujiguan'+ combobox6.Text+''''+combobox7.Text+'''';
if combobox6.Text='like' then
sqlstr:=sqlstr+ combobox4.Text+' stujiguan like ''%'+combobox7.Text+'%''';
end;
if combobox5.Text='奖励、惩罚、变更' then
begin
if combobox6.Text<>'like' then
sqlstr:=sqlstr+ combobox4.Text+' stucontent'+ combobox6.Text+''''+combobox7.Text+'''';
if combobox6.Text='like' then
sqlstr:=sqlstr+ combobox4.Text+' stucontent like ''%'+combobox7.Text+'%''';
end;
if combobox5.Text='奖励、惩罚、变更日期' then
begin
if combobox6.Text<>'like' then
sqlstr:=sqlstr+ combobox4.Text+' date'+ combobox6.Text+''''+combobox7.Text+'''';
if combobox6.Text='like' then
sqlstr:=sqlstr+ combobox4.Text+' date like ''%'+combobox7.Text+'%''';
end;
if combobox9.Text='学号' then
begin
if combobox10.Text<>'like' then
sqlstr:=sqlstr+ combobox8.Text+' a.stuid'+ combobox10.Text+''''+combobox11.Text+'''';
if combobox10.Text='like' then
sqlstr:=sqlstr+ combobox8.Text+' a.stuid like ''%'+combobox11.Text+'%''';
end;
if combobox9.Text='姓名' then
begin
if combobox10.Text<>'like' then
sqlstr:=sqlstr+ combobox8.Text+' stuname'+ combobox10.Text+''''+combobox11.Text+'''';
if combobox10.Text='like' then
sqlstr:=sqlstr+ combobox8.Text+' stuname like ''%'+combobox11.Text+'%''';
end;
if combobox9.Text='姓别' then
begin
if combobox10.Text<>'like' then
sqlstr:=sqlstr+ combobox8.Text+' stuname'+ combobox10.Text+''''+combobox11.Text+'''';
if combobox10.Text='like' then
sqlstr:=sqlstr+ combobox8.Text+' stuname like ''%'+combobox11.Text+'%''';
end;
if combobox9.Text='生日' then
begin
if combobox10.Text<>'like' then
sqlstr:=sqlstr+ combobox8.Text+' stubirthday'+ combobox10.Text+''''+combobox11.Text+'''';
if combobox10.Text='like' then
sqlstr:=sqlstr+ combobox8.Text+' stubirthday like ''%'+combobox11.Text+'%''';
end;
if combobox9.Text='班级' then
begin
if combobox10.Text<>'like' then
sqlstr:=sqlstr+ combobox8.Text+' stuclass'+ combobox10.Text+''''+combobox11.Text+'''';
if combobox10.Text='like' then
sqlstr:=sqlstr+ combobox8.Text+' stuclass like ''%'+combobox11.Text+'%''';
end;
if combobox9.Text='系别' then
begin
if combobox10.Text<>'like' then
sqlstr:=sqlstr+ combobox8.Text+' studepart'+ combobox10.Text+''''+combobox11.Text+'''';
if combobox10.Text='like' then
sqlstr:=sqlstr+ combobox8.Text+' studepart like ''%'+combobox11.Text+'%''';
end;
if combobox9.Text='籍贯' then
begin
if combobox10.Text<>'like' then
sqlstr:=sqlstr+ combobox8.Text+' stujiguan'+ combobox10.Text+''''+combobox11.Text+'''';
if combobox10.Text='like' then
sqlstr:=sqlstr+ combobox8.Text+' stujiguan like ''%'+combobox11.Text+'%''';
end;
if combobox9.Text='奖励、惩罚、变更' then
begin
if combobox10.Text<>'like' then
sqlstr:=sqlstr+ combobox8.Text+' stucontent'+ combobox10.Text+''''+combobox11.Text+'''';
if combobox10.Text='like' then
sqlstr:=sqlstr+ combobox8.Text+' stucontent like ''%'+combobox11.Text+'%''';
end;
if combobox9.Text='奖励、惩罚、变更日期' then
begin
if combobox10.Text<>'like' then
sqlstr:=sqlstr+ combobox8.Text+' date'+ combobox10.Text+''''+combobox11.Text+'''';
if combobox10.Text='like' then
sqlstr:=sqlstr+ combobox8.Text+' date like ''%'+combobox11.Text+'%''';
end;
if combobox13.Text='学号' then
begin
if combobox14.Text<>'like' then
sqlstr:=sqlstr+ combobox12.Text+' a.stuid'+ combobox14.Text+''''+combobox15.Text+'''';
if combobox14.Text='like' then
sqlstr:=sqlstr+ combobox12.Text+' a.stuid like ''%'+combobox15.Text+'%''';
end;
if combobox13.Text='姓名' then
begin
if combobox14.Text<>'like' then
sqlstr:=sqlstr+ combobox12.Text+' stuname'+ combobox14.Text+''''+combobox15.Text+'''';
if combobox14.Text='like' then
sqlstr:=sqlstr+ combobox12.Text+' stuname like ''%'+combobox15.Text+'%''';
end;
if combobox13.Text='姓别' then
begin
if combobox14.Text<>'like' then
sqlstr:=sqlstr+ combobox12.Text+' stuname'+ combobox14.Text+''''+combobox15.Text+'''';
if combobox14.Text='like' then
sqlstr:=sqlstr+ combobox12.Text+' stuname like ''%'+combobox15.Text+'%''';
end;
if combobox13.Text='生日' then
begin
if combobox14.Text<>'like' then
sqlstr:=sqlstr+ combobox12.Text+' stubirthday'+ combobox14.Text+''''+combobox15.Text+'''';
if combobox14.Text='like' then
sqlstr:=sqlstr+ combobox12.Text+' stubirthday like ''%'+combobox15.Text+'%''';
end;
if combobox13.Text='班级' then
begin
if combobox14.Text<>'like' then
sqlstr:=sqlstr+ combobox12.Text+' stuclass'+ combobox14.Text+''''+combobox15.Text+'''';
if combobox14.Text='like' then
sqlstr:=sqlstr+ combobox12.Text+' stuclass like ''%'+combobox15.Text+'%''';
end;
if combobox13.Text='系别' then
begin
if combobox14.Text<>'like' then
sqlstr:=sqlstr+ combobox12.Text+' studepart'+ combobox14.Text+''''+combobox15.Text+'''';
if combobox14.Text='like' then
sqlstr:=sqlstr+ combobox12.Text+' studepart like ''%'+combobox15.Text+'%''';
end;
if combobox13.Text='籍贯' then
begin
if combobox14.Text<>'like' then
sqlstr:=sqlstr+ combobox12.Text+' stujiguan'+ combobox14.Text+''''+combobox15.Text+'''';
if combobox14.Text='like' then
sqlstr:=sqlstr+ combobox12.Text+' stujiguan like ''%'+combobox15.Text+'%''';
end;
if combobox13.Text='奖励、惩罚、变更' then
begin
if combobox14.Text<>'like' then
sqlstr:=sqlstr+ combobox12.Text+' stucontent'+ combobox14.Text+''''+combobox15.Text+'''';
if combobox14.Text='like' then
sqlstr:=sqlstr+ combobox12.Text+' stucontent like ''%'+combobox15.Text+'%''';
end;
if combobox13.Text='奖励、惩罚、变更日期' then
begin
if combobox14.Text<>'like' then
sqlstr:=sqlstr+ combobox12.Text+' date'+ combobox14.Text+''''+combobox15.Text+'''';
if combobox14.Text='like' then
sqlstr:=sqlstr+ combobox12.Text+' date like ''%'+combobox15.Text+'%''';
end;
if combobox17.Text='学号' then
begin
if combobox18.Text<>'like' then
sqlstr:=sqlstr+ combobox16.Text+' a.stuid'+ combobox18.Text+''''+combobox19.Text+'''';
if combobox18.Text='like' then
sqlstr:=sqlstr+ combobox16.Text+' a.stuid like ''%'+combobox19.Text+'%''';
end;
if combobox17.Text='姓名' then
begin
if combobox18.Text<>'like' then
sqlstr:=sqlstr+ combobox16.Text+' stuname'+ combobox18.Text+''''+combobox19.Text+'''';
if combobox18.Text='like' then
sqlstr:=sqlstr+ combobox16.Text+' stuname like ''%'+combobox19.Text+'%''';
end;
if combobox17.Text='姓别' then
begin
if combobox18.Text<>'like' then
sqlstr:=sqlstr+ combobox16.Text+' stuname'+ combobox18.Text+''''+combobox19.Text+'''';
if combobox18.Text='like' then
sqlstr:=sqlstr+ combobox16.Text+' stuname like ''%'+combobox19.Text+'%''';
end;
if combobox17.Text='生日' then
begin
if combobox18.Text<>'like' then
sqlstr:=sqlstr+ combobox16.Text+' stubirthday'+ combobox18.Text+''''+combobox19.Text+'''';
if combobox18.Text='like' then
sqlstr:=sqlstr+ combobox16.Text+' stubirthday like ''%'+combobox19.Text+'%''';
end;
if combobox17.Text='班级' then
begin
if combobox18.Text<>'like' then
sqlstr:=sqlstr+ combobox16.Text+' stuclass'+ combobox18.Text+''''+combobox19.Text+'''';
if combobox18.Text='like' then
sqlstr:=sqlstr+ combobox16.Text+' stuclass like ''%'+combobox19.Text+'%''';
end;
if combobox17.Text='系别' then
begin
if combobox18.Text<>'like' then
sqlstr:=sqlstr+ combobox16.Text+' studepart'+ combobox18.Text+''''+combobox19.Text+'''';
if combobox18.Text='like' then
sqlstr:=sqlstr+ combobox16.Text+' studepart like ''%'+combobox19.Text+'%''';
end;
if combobox17.Text='籍贯' then
begin
if combobox18.Text<>'like' then
sqlstr:=sqlstr+ combobox16.Text+' stujiguan'+ combobox18.Text+''''+combobox19.Text+'''';
if combobox18.Text='like' then
sqlstr:=sqlstr+ combobox16.Text+' stujiguan like ''%'+combobox19.Text+'%''';
end;
if combobox17.Text='奖励、惩罚、变更' then
begin
if combobox18.Text<>'like' then
sqlstr:=sqlstr+ combobox16.Text+' stucontent'+ combobox18.Text+''''+combobox19.Text+'''';
if combobox18.Text='like' then
sqlstr:=sqlstr+ combobox16.Text+' stucontent like ''%'+combobox19.Text+'%''';
end;
if combobox17.Text='奖励、惩罚、变更日期' then
begin
if combobox18.Text<>'like' then
sqlstr:=sqlstr+ combobox16.Text+' date'+ combobox18.Text+''''+combobox19.Text+'''';
if combobox18.Text='like' then
sqlstr:=sqlstr+ combobox16.Text+' date like ''%'+combobox19.Text+'%''';
end;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add(sqlstr);
adoquery1.Open;
f_chaxunxianshi.show;
end;
procedure Tf_chaxun.BitBtn2Click(Sender: TObject);
begin
close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -