📄 freesearch.pas
字号:
unit freesearch;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, StdCtrls, ExtCtrls, DB, DBTables, ADODB;
type
TForm14 = class(TForm)
Panel1: TPanel;
Bevel2: TBevel;
Bevel1: TBevel;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button2: TButton;
GroupBox1: TGroupBox;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label4: TLabel;
Label3: TLabel;
Label1: TLabel;
Label9: TLabel;
ComboBox4: TComboBox;
ComboBox5: TComboBox;
ComboBox6: TComboBox;
ComboBox7: TComboBox;
ComboBox3: TComboBox;
ComboBox1: TComboBox;
Edit1: TEdit;
Edit2: TEdit;
DBGrid1: TDBGrid;
Button1: TButton;
Button7: TButton;
DataSource1: TDataSource;
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form14: TForm14;
implementation
{$R *.dfm}
procedure TForm14.Button6Click(Sender: TObject);
begin
form14.Close;
end;
procedure TForm14.Button7Click(Sender: TObject);
begin
edit1.Text:='';
edit2.Text:='';
combobox1.Text:='';
combobox3.Text:='';
combobox4.Text:='';
combobox5.Text:='';
combobox6.Text:='';
combobox7.Text:='';
adoquery1.SQL.Text:='';
adoquery1.Active:=false;
end;
procedure TForm14.Button1Click(Sender: TObject);
var
s:string;
begin
if (combobox1.Text='') and (combobox5.Text='') and (combobox4.text='') and (combobox6.Text='' ) and (combobox3.Text ='')and(combobox7.Text='')and (edit1.Text ='')and (edit2.Text='')then
begin
application.MessageBox('请选择信息集条件','提示',32);
end
else if (edit1.Text ='')and(combobox1.Text='') and (combobox5.Text='') and (combobox4.text='') and (combobox6.Text='' ) and (combobox3.Text <>'')and(combobox7.Text='')and(edit2.Text='')then
begin //性别
adoquery1.Active:=false;
adoquery1.sql.Clear;
s:='select * from a01 where 性别='''+combobox3.Text+'''';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount<>0 then
begin
button2.Enabled:=true;
button3.Enabled:=true;
button4.Enabled:=true;
button5.Enabled:=true;
end
else
begin
button2.Enabled:=false;
button3.Enabled:=false;
button4.Enabled:=false;
button5.Enabled:=false;
end;
end
else if (edit1.Text ='')and(combobox1.Text='') and (combobox5.Text<>'') and (combobox4.text<>'') and (combobox6.Text='' ) and (combobox3.Text='')and(combobox7.Text='')and(edit2.Text='')then
begin //年龄
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01 where '+' 年龄 between '+ combobox4.text+' and '+combobox5.Text;
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount<>0 then
begin
button2.Enabled:=true;
button3.Enabled:=true;
button4.Enabled:=true;
button5.Enabled:=true;
end
else
begin
button2.Enabled:=false;
button3.Enabled:=false;
button4.Enabled:=false;
button5.Enabled:=false;
end;
end
else if (edit1.Text ='')and(combobox1.Text='') and (combobox5.Text='') and (combobox4.text='') and (combobox6.Text<>'' ) and (combobox3.Text='')and(combobox7.Text<>'')and(edit2.Text='')then
begin //学历
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01,a08 where '+'学历代码 between '+inttostr(combobox6.itemindex)+' and '+inttostr(combobox7.ItemIndex)+' and '+' a01.标识号=a08.标识号';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount<>0 then
begin
button2.Enabled:=true;
button3.Enabled:=true;
button4.Enabled:=true;
button5.Enabled:=true;
end
else
begin
button2.Enabled:=false;
button3.Enabled:=false;
button4.Enabled:=false;
button5.Enabled:=false;
end;
end
else if (edit1.Text ='')and(combobox1.Text<>'') and (combobox5.Text='') and (combobox4.text='') and (combobox6.Text='' ) and (combobox3.Text='')and(combobox7.Text='') and(edit2.Text='')then
begin //人事单位名称
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01 where 人事单位名称='''+combobox1.text+'''';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount<>0 then
begin
button2.Enabled:=true;
button3.Enabled:=true;
button4.Enabled:=true;
button5.Enabled:=true;
end
else
begin
button2.Enabled:=false;
button3.Enabled:=false;
button4.Enabled:=false;
button5.Enabled:=false;
end;
end
else if (edit1.Text <>'')and(combobox1.Text='') and (combobox5.Text='') and (combobox4.text='') and (combobox6.Text='' ) and (combobox3.Text='')and(combobox7.Text='')and(edit2.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
button2.Enabled:=true;
button3.Enabled:=true;
button4.Enabled:=true;
button5.Enabled:=true;
end
else
begin
button2.Enabled:=false;
button3.Enabled:=false;
button4.Enabled:=false;
button5.Enabled:=false;
end;
end
else if (edit1.Text ='')and(combobox1.Text='') and (combobox5.Text='') and (combobox4.text='') and (combobox6.Text='' ) and (combobox3.Text='')and(combobox7.Text='')and(edit2.Text<>'') then
begin //出生日期
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01 where 出生日期='''+edit2.Text+'''';
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount<>0 then
begin
button2.Enabled:=true;
button3.Enabled:=true;
button4.Enabled:=true;
button5.Enabled:=true;
end
else
begin
button2.Enabled:=false;
button3.Enabled:=false;
button4.Enabled:=false;
button5.Enabled:=false;
end;
end
else if (edit1.Text ='')and(combobox1.Text='') and (combobox5.Text<>'') and (combobox4.text<>'') and (combobox6.Text='' ) and (combobox3.Text<>'')and(combobox7.Text='')and(edit2.Text='') then
begin //年龄和性别
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01 where 性别='''+combobox3.Text+''''+' and 年龄 between '+combobox4.text+' and '+combobox5.text;
adoquery1.sql.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount<>0 then
begin
button2.Enabled:=true;
button3.Enabled:=true;
button4.Enabled:=true;
button5.Enabled:=true;
end
else
begin
button2.Enabled:=false;
button3.Enabled:=false;
button4.Enabled:=false;
button5.Enabled:=false;
end;
end
else if (edit1.Text ='')and(combobox1.Text='') and (combobox5.Text<>'') and (combobox4.text<>'') and (combobox6.Text<>'' ) and (combobox3.Text='')and(combobox7.Text<>'')and(edit2.Text='')then
begin //年龄和学历
adoquery1.Active :=false;
adoquery1.sql.Clear;
s:='select * from a01,a08 where '+' 年龄 between '+combobox4.text+' and '+combobox5.text+' and '+' 学历代码 between '+inttostr(combobox6.itemindex)+' and '+inttostr(combobox7.itemindex)+' and '+' a01.标识号 = a08.标识号';
adoquery1.SQL.Add(s);
adoquery1.Active :=true;
if adoquery1.RecordCount<>0 then
begin
button2.Enabled:=true;
button3.Enabled:=true;
button4.Enabled:=true;
button5.Enabled:=true;
end
else
begin
button2.Enabled:=false;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -