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

📄 doublesearch.pas

📁 一个不错的信息管理系统
💻 PAS
字号:
unit doublesearch;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, StdCtrls, DB, DBTables, ExtCtrls, ADODB;
type
  TForm13 = class(TForm)
    Panel1: TPanel;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label8: TLabel;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    ComboBox3: TComboBox;
    ComboBox4: TComboBox;
    ComboBox5: TComboBox;
    ComboBox6: TComboBox;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Edit1: TEdit;
    Label7: TLabel;
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    ADOConnection1: TADOConnection;
    ADOQuery1: TADOQuery;
    procedure Button3Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form13: TForm13;

implementation

{$R *.dfm}

procedure TForm13.Button3Click(Sender: TObject);
begin
edit1.Text:='';
combobox1.Text :='';
combobox2.Text :='';
combobox3.Text :='';
combobox4.Text :='';
combobox5.Text :='';
combobox6.Text :='';
adoquery1.SQL.Text:='';
adoquery1.Active:=false;
form13.close;
end;

procedure TForm13.Button2Click(Sender: TObject);
begin
edit1.Text:='';
combobox1.Text :='';
combobox2.Text :='';
combobox3.Text :='';
combobox4.Text :='';
combobox5.Text :='';
combobox6.Text :='';
adoquery1.SQL.Text:='';
adoquery1.Active:=false;
edit1.SetFocus;
end;

procedure TForm13.Button1Click(Sender: TObject);
var
s:string;
begin
if (combobox1.Text='') and (combobox2.Text='') and (combobox3.Text='') and (combobox4.text='') and (combobox5.Text='' ) and (combobox6.Text ='')and(edit1.Text ='')then
begin
beep();
application.MessageBox('请选择信息集条件','提示',32);
end
else if (combobox1.Text<>'') and (combobox2.Text<>'') and (combobox3.Text='') and (combobox4.text='') and (combobox5.Text='' ) and (combobox6.Text ='')and(edit1.Text ='')then
begin                          //年龄
adoquery1.Active:=false;
adoquery1.sql.Clear;
s:='select * from a01 where '+' 年龄 between '+combobox1.text+' and '+combobox2.text;
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then begin
beep();
application.MessageBox('没有您想要的记录','提示',32);
end;
end
else if (combobox1.Text='') and (combobox2.Text='') and (combobox3.Text<>'') and (combobox4.text<>'') and (combobox5.Text='' ) and (combobox6.Text ='')and(edit1.Text ='')then
begin                                //学历
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01,a08 where '+' 学历代码 between '+inttostr(combobox3.itemindex)+' and '+inttostr(combobox4.itemindex)+' and '+' a01.标识号=a08.标识号';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then    begin
beep();
application.MessageBox('没有您想要的记录','提示',32);
end;
end
else if (combobox1.Text='') and (combobox2.Text='') and (combobox3.Text='') and (combobox4.text='') and (combobox5.Text<>'' ) and (combobox6.Text ='')and(edit1.Text ='')then
begin                                      //性别
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01 where 性别='''+combobox5.Text+'''';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then  begin
beep();
application.MessageBox('没有您想要查询的记录!','提示',32);
end;
end
else if (combobox1.Text='') and (combobox2.Text='') and (combobox3.Text='') and (combobox4.text='') and (combobox5.Text='' ) and (combobox6.Text ='')and(edit1.Text <>'')then
begin                                      //姓名
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01 where 姓名='''+edit1.Text+'''';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then    begin
beep();
application.MessageBox('没有您想要的记录','提示',32);
end;
end
else if (combobox1.Text='') and (combobox2.Text='') and (combobox3.Text='') and (combobox4.text='') and (combobox5.Text='' ) and (combobox6.Text <>'')and(edit1.Text ='')then
begin                                     //人事单位名称
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01 where 人事单位名称='''+combobox6.text+'''';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then  begin
beep();
application.MessageBox('没有您想要的记录','提示',32);
end;
end
else if (combobox1.Text<>'') and (combobox2.Text<>'') and (combobox3.Text='') and (combobox4.text='') and (combobox5.Text<>'' ) and (combobox6.Text ='')and(edit1.Text ='')then
begin                                      //性别和年龄
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01 where 性别='''+combobox5.Text+''''+' and 年龄 between '+combobox1.Text+' and '+combobox2.Text;
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then   begin
beep();
application.MessageBox('没有您想要的记录','提示',32);
end;
end
else if (combobox1.Text<>'') and (combobox2.Text<>'') and (combobox3.Text<>'') and (combobox4.text<>'') and (combobox5.Text='' ) and (combobox6.Text ='')and(edit1.Text ='')then
begin                                    //年龄和学历
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01,a08 where '+' 年龄 between '+combobox1.text+' and '+combobox2.text+' and '+' 学历代码 between '+inttostr(combobox3.itemindex)+' and '+inttostr(combobox4.itemindex)+' and '+' a01.标识号 = a08.标识号';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then     begin
beep();
application.MessageBox('没有您想要的记录','提示',32);
end;
end
else if (combobox1.Text<>'') and (combobox2.Text<>'') and (combobox3.Text<>'') and (combobox4.text<>'') and (combobox5.Text<>'' ) and (combobox6.Text ='')and(edit1.Text ='')then
begin                                     //性别和年龄和学历
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01,a08 where 性别='''+combobox5.Text+''''+' and '+' 年龄 between '+combobox1.text+' and '+combobox2.text+' and '+' a08.学历代码 between '+inttostr(combobox3.itemindex)+' and '+inttostr(combobox4.itemindex)+'and a01.标识号 = a08.标识号';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then  begin
beep();
application.MessageBox('没有您想要的记录','提示',32);
end;
end
else if (combobox1.Text='') and (combobox2.Text='') and (combobox3.Text<>'') and (combobox4.text<>'') and (combobox5.Text<>'' ) and (combobox6.Text ='')and(edit1.Text ='')then
begin                                    //性别和学历
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01,a08 where 性别='''+combobox5.Text+''''+' and 学历代码 between '+inttostr(combobox3.itemindex)+' and '+inttostr(combobox4.itemindex)+' and a01.标识号=a08.标识号';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then   begin
beep();
application.MessageBox('没有您想要的记录','提示',32);
end;
end
else if (combobox1.Text='') and (combobox2.Text='') and (combobox3.Text='') and (combobox4.text='') and (combobox5.Text<>'' ) and (combobox6.Text <>'')and(edit1.Text ='')then
begin                                    //性别和单位
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01 where 性别='''+combobox5.Text+''''+' and '+' 人事单位名称='''+combobox6.Text+'''';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then    begin
beep();
application.MessageBox('没有您想要的记录','提示',32);
end;
end
else if (combobox1.Text<>'') and (combobox2.Text<>'') and (combobox3.Text='') and (combobox4.text='') and (combobox5.Text='' ) and (combobox6.Text <>'')and(edit1.Text ='')then
begin                               //年龄和单位
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01 where 人事单位名称='''+combobox6.Text+''''+' and '+' 年龄 between '+combobox1.text+' and '+combobox2.text;
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then  begin
beep();
application.MessageBox('没有您想要的记录','提示',32);
end;
end
else if (combobox1.Text='') and (combobox2.Text='') and (combobox3.Text<>'') and (combobox4.text<>'') and (combobox5.Text='' ) and (combobox6.Text <>'')and(edit1.Text ='')then
begin                                  //学历和单位
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01,a08 where 人事单位名称='''+combobox6.Text+''''+' and '+' 学历代码 between '+inttostr(combobox3.itemindex)+' and '+inttostr(combobox4.itemindex)+' and a01.标识号=a08.标识号';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then    begin
beep();
application.MessageBox('没有您想要的记录','提示',32);
end;
end
 else if (combobox1.Text<>'') and (combobox2.Text<>'') and (combobox3.Text='') and (combobox4.text='') and (combobox5.Text<>'' ) and (combobox6.Text <>'')and(edit1.Text ='')then
begin                                //单位和年龄和性别
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01 where 性别='''+combobox5.Text+''''+' and '+' 年龄 between '+combobox1.text+' and '+combobox2.text+' and '+'人事单位名称='''+combobox6.Text+'''' ;
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then   begin
beep();
application.MessageBox('没有您想要的记录','提示',32);
end;
end
else if (combobox1.Text<>'') and (combobox2.Text<>'') and (combobox3.Text<>'') and (combobox4.text<>'') and (combobox5.Text='' ) and (combobox6.Text <>'')and(edit1.Text ='')then
begin                               //学历和单位和年龄
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01,a08 where 人事单位名称='''+combobox6.text+''''+' and '+' 年龄 between '+combobox1.Text+' and '+combobox2.Text+' and '+' a08.学历代码 between '+inttostr(combobox3.ItemIndex)+' and '+inttostr(combobox4.ItemIndex)+' and '+' a01.标识号=a08.标识号';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then      begin
beep();
application.MessageBox('没有您想要的记录','提示',32);
end;
end
 else if (combobox1.Text='') and (combobox2.Text='') and (combobox3.Text<>'') and (combobox4.text<>'') and (combobox5.Text<>'' ) and (combobox6.Text <>'')and(edit1.Text ='')then
begin                                //学历和单位和性别
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01,a08 where 人事单位名称='''+combobox6.text+''''+' and '+' 性别='''+combobox5.Text+''''+' and '+' a08.学历代码 between '+inttostr(combobox3.ItemIndex)+' and '+inttostr(combobox4.ItemIndex)+' and '+' a01.标识号=a08.标识号';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then   begin
beep();
application.MessageBox('没有您想要的记录','提示',32);
end;
end
 else if (combobox1.Text<>'') and (combobox2.Text<>'') and (combobox3.Text<>'') and (combobox4.text<>'') and (combobox5.Text<>'' ) and (combobox6.Text <>'')and(edit1.Text ='')then
begin                                //年龄、学历、单位和性别
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01,a08 where 人事单位名称='''+combobox6.text+''''+' and '+' 性别='''+combobox5.Text+''''+' and '+' a08.学历代码 between '+inttostr(combobox3.ItemIndex)+' and '+inttostr(combobox4.ItemIndex)+' and '+' 年龄 between '+combobox1.text+' and '+combobox2.text+' and '+' a01.标识号=a08.标识号';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then   begin
beep();
application.MessageBox('没有您想要的记录','提示',32);
end;
end
 else if (combobox1.Text<>'') and (combobox2.Text<>'') and (combobox3.Text<>'') and (combobox4.text<>'') and (combobox5.Text<>'' ) and (combobox6.Text <>'')and(edit1.Text<>'')then
begin                                //年龄、学历、单位、姓名和性别
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01,a08 where 人事单位名称='''+combobox6.text+''''+' and '+' 性别='''+combobox5.Text+''''+' and '+' a08.学历代码 between '+inttostr(combobox3.ItemIndex)+' and '+inttostr(combobox4.ItemIndex)+' and '+' 年龄 between '+combobox1.text+' and '+combobox2.text+' and '+' 姓名='''+edit1.Text+''''+' and '+' a01.标识号=a08.标识号';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then    begin
beep();
application.MessageBox('没有您想要的记录','提示',32);
end;
end
 else if (combobox1.Text<>'') and (combobox2.Text<>'') and (combobox3.Text<>'') and (combobox4.text<>'') and (combobox5.Text='') and (combobox6.Text <>'')and(edit1.Text<>'')then
begin                                //年龄、学历、单位、和姓名
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01,a08 where 人事单位名称='''+combobox6.text+''''+' and '+' 姓名='''+edit1.Text+''''+' and '+' a08.学历代码 between '+inttostr(combobox3.ItemIndex)+' and '+inttostr(combobox4.ItemIndex)+' and '+' 年龄 between '+combobox1.text+' and '+combobox2.text+' and '+' a01.标识号=a08.标识号';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount=0 then  begin
beep();
application.MessageBox('没有您想要的记录','提示',32);
end;
end
else
begin
beep();
application.MessageBox('没有找到符合条件的记录!','提示',32);
end;
end;




end.

⌨️ 快捷键说明

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