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

📄 chaxun.~pas

📁 一个文件管理的程序
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
    edit9.Text:=treeview1.Selected.Text;
    exit;
  end;
  try     //6
   s6:=treeview1.Selected.Parent.Parent.Parent.Parent.Parent.Parent.Text;
  except
    edit9.Text:='';
    edit8.Text:='';
    edit7.Text:='';
    edit6.Text:='';
    edit10.Text:=treeview1.Selected.Text;
    exit;
  end;
end;

procedure TForm6.TreeView2Click(Sender: TObject);
var
t1,t2,t3,t4,t5,t6:string;
begin
 edit3.Text:=treeview2.Selected.Text;
 try     //1
   t1:=treeview2.Selected.Parent.Text;
    except
    edit15.Text:='';
    edit14.Text:='';
    edit13.Text:='';
    edit12.Text:='';
    edit11.Text:='';
    edit3.Text:=treeview2.Selected.Text;
    exit;
 end;
  try     //2
   t2:=treeview2.Selected.Parent.Parent.Text;
  except
   edit15.Text:='';
   edit14.Text:='';
   edit13.Text:='';
   edit12.Text:='';
   edit11.Text:=treeview2.Selected.Text;
   exit;
 end;
  try     //3
   t3:=treeview2.Selected.Parent.Parent.Parent.Text;
   except
    edit15.Text:='';
    edit14.Text:='';
    edit13.Text:='';
    edit11.Text:='';
    edit12.Text:=treeview2.Selected.Text;
    exit;
 end;
  try     //4
   t4:=treeview2.Selected.Parent.Parent.Parent.Parent.Text;
   except
    edit15.Text:='';
    edit14.Text:='';
    edit12.Text:='';
    edit11.Text:='';
    edit13.Text:=treeview2.Selected.Text;
    exit;
 end;
  try     //5
   t5:=treeview2.Selected.Parent.Parent.Parent.Parent.Parent.Text;
   except
    edit15.Text:='';
    edit13.Text:='';
    edit12.Text:='';
    edit11.Text:='';
    edit14.Text:=treeview2.Selected.Text;
    exit;
  end;
  try     //6
   t6:=treeview2.Selected.Parent.Parent.Parent.Parent.Parent.Parent.Text;
   except
    edit13.Text:='';
    edit14.Text:='';
    edit12.Text:='';
    edit11.Text:='';
    edit15.Text:=treeview2.Selected.Text;
    exit;
  end;
end;
procedure TForm6.Image2Click(Sender: TObject);
var
   s1,s2,s3,s4,s5,s:string;
   usenode,usenode1:ttreenode;
   tongji:integer;
begin
adodataset5.Filtered:=false;
adodataset5.Active:=false;
adodataset5.CommandText:='select * from total';
adodataset5.Active:=true;
//关键词查询
if trim(edit1.Text)<>'' then
begin
  s:=edit1.Text;
  //截取关键词
  if trim(s)<>'' then
    begin
      if ansipos(' ',trim(s))<>0 then
      begin
         s1:=leftstr(trim(s),ansipos(' ',trim(s)) - 1);
         s:=rightstr(trim(s),strlen(pchar(trim(s))) - ansipos(' ',trim(s)));
         tongji:=1;
      end
      else
      begin
         s1:=s;
         tongji:=1;
      end;
    end ;
  if trim(s)<>'' then
    begin
      if ansipos(' ',trim(s))<>0 then
      begin
         s2:=leftstr(trim(s),ansipos(' ',trim(s)) - 1);
         s:=rightstr(trim(s),strlen(pchar(trim(s))) - ansipos(' ',trim(s)));
         tongji:=2;
      end
      else
      begin
         s2:=s;
         s:='';
         tongji:=2;
      end;
    end ;
  if trim(s)<>'' then
    begin
     if ansipos(' ',trim(s))<>0 then
      begin
         s3:=leftstr(trim(s),ansipos(' ',trim(s)) - 1);
         s:=rightstr(trim(s),strlen(pchar(trim(s))) - ansipos(' ',trim(s)));
         tongji:=3;
      end
      else
      begin
         s3:=s;
         s:='';
         tongji:=3;
      end;
    end ;
  if trim(s)<>'' then
    begin
     if ansipos(' ',trim(s))<>0 then
      begin
         s4:=leftstr(trim(s),ansipos(' ',trim(s)) - 1);
         s:=rightstr(trim(s),strlen(pchar(trim(s))) - ansipos(' ',trim(s)));
         tongji:=4;
      end
      else
      begin
         s4:=s;
         s:='';
         tongji:=4;
      end;
    end ;
  if trim(s)<>'' then
    begin
     if ansipos(' ',trim(s))<>0 then
      begin
         s5:=leftstr(trim(s),ansipos(' ',trim(s)) - 1);
         s:=rightstr(trim(s),strlen(pchar(trim(s))) - ansipos(' ',trim(s)));
         tongji:=5;
      end
      else
      begin
         s5:=s;
         s:='';
         tongji:=5;
      end;
    end ;
  //开始搜索
  if tongji=1 then
    begin
      adodataset5.Active:=false;
      adodataset5.CommandText:='select * from total where filename  like '+''''+'%'+s1+'%'+'''';
      adodataset5.Active:=true;
    end;
  if tongji=2 then
    begin
      adodataset5.Active:=false;
      adodataset5.CommandText:='select * from total where filename  like '+''''+'%'+s1+'%'+''''+ ' and filename like '+''''+'%'+s2+'%'+'''';
      adodataset5.Active:=true;
    end;
  if tongji=3 then
    begin
      adodataset5.Active:=false;
      adodataset5.CommandText:='select * from total where filename  like '+''''+'%'+s1+'%'+''''+ ' and filename like '+''''+'%'+s2+'%'+''''+ ' and filename like '+''''+'%'+s3+'%'+'''';
      adodataset5.Active:=true;
    end;
  if tongji=4 then
    begin
      adodataset5.Active:=false;
      adodataset5.CommandText:='select * from total where filename  like '+''''+'%'+s1+'%'+''''+ ' and filename like '+''''+'%'+s2+'%'+''''+ ' and filename like '+''''+'%'+s3+'%'+''''+ ' and filename like '+''''+'%'+s4+'%'+'''';
      adodataset5.Active:=true;
    end;
  if tongji=5 then
    begin
      adodataset5.Active:=false;
      adodataset5.CommandText:='select * from total where filename  like '+''''+'%'+s1+'%'+''''+ ' and filename like '+''''+'%'+s2+'%'+''''+ ' and filename like '+''''+'%'+s3+'%'+''''+ ' and filename like '+''''+'%'+s4+'%'+''''+ ' and filename like '+''''+'%'+s5+'%'+'''';
      adodataset5.Active:=true;
    end;
  end
 else if trim(edit1.Text)='' then
  begin
   if trim(edit2.Text)='根' then                   //点击树‘根’时处理命令
    begin
     showmessage('请选择主题词为条件进行查询!');
     exit;
    end;
   if trim(edit6.Text)<>'' then   //1
    begin //(1-1)
     edit5.Text:='';
     adodataset5.Active:=false;
     adodataset5.CommandText:='select * from total where zhutc like '+''''+'%'+edit6.text+'%'+'''';
     adodataset5.Active:=true;
    end;
   if trim(edit7.Text)<>'' then   //2
    begin
     edit5.Text:='';
     adodataset5.Active:=false;
     adodataset5.CommandText:='select * from total where zhutc like '+''''+'%'+edit7.text+'%'+'''';
     adodataset5.Active:=true;
    end;
   if trim(edit8.Text)<>'' then       //3
    begin     //(1-3)
     edit5.Text:='';
     adodataset5.Active:=false;
     adodataset5.CommandText:='select * from total where zhutc like '+''''+'%'+edit8.text+'%'+'''';
     adodataset5.Active:=true;
    end;
   if trim(edit9.Text)<>'' then           //4
    begin  //(1-4)
     edit5.Text:='';
     adodataset5.Active:=false;
     adodataset5.CommandText:='select * from total where zhutc like '+''''+'%'+edit9.text+'%'+'''';
     adodataset5.Active:=true;
    end;
   if trim(edit10.Text)<>'' then            //5
    begin   //(1-5)
     edit5.Text:='';
     adodataset5.Active:=false;
     adodataset5.CommandText:='select * from total where zhutc like '+''''+'%'+edit10.text+'%'+'''';
     adodataset5.Active:=true;
    end; //(1-5)
 //以部门为检索条件
   if trim(edit11.Text)<>'' then            //1
    begin
     edit5.Text:='';
     adodataset5.Active:=false;
     adodataset5.CommandText:='select * from total where department like '+''''+'%'+edit11.text+'%'+'''';
     adodataset5.Active:=true;
    end;
   if trim(edit12.Text)<>'' then             //2
    begin
     edit5.Text:='';
     adodataset5.Active:=false;
     adodataset5.CommandText:='select * from total where department like '+''''+'%'+edit12.text+'%'+'''';
     adodataset5.Active:=true;
    end;                                     //3
   if trim(edit13.Text)<>'' then
    begin
     edit5.Text:='';
     adodataset5.Active:=false;
     adodataset5.CommandText:='select * from total where department like '+''''+'%'+edit13.text+'%'+'''';
     adodataset5.Active:=true;
    end;
   if trim(edit14.Text)<>'' then             //4
    begin
     edit5.Text:='';
     adodataset5.Active:=false;
     adodataset5.CommandText:='select * from total where department like '+''''+'%'+edit14.text+'%'+'''';
     adodataset5.Active:=true;
    end;
   if trim(edit15.Text)<>'' then             //5
    begin
     edit5.Text:='';
     adodataset5.Active:=false;
     adodataset5.CommandText:='select * from total where department like '+''''+'%'+edit15.text+'%'+'''';
     adodataset5.Active:=true;
    end;
   if trim(combobox1.Text)<>'' then
    begin
     edit5.Text:='';
     adodataset5.Active:=false;
     adodataset5.CommandText:='select * from total where filetype like '+''''+'%'+combobox1.Text+'%'+'''';
     adodataset5.Active:=true;
    end;
   if trim(edit5.text)<>''then   //以时间为查询条件
    begin
     adodataset5.Filter:='time>='''+edit5.Text+'''';
     adodataset5.Filtered:=true;
     adodataset5.Open;
    end;
 end;
 edit1.Text:='';
 edit2.Text:='';
 edit3.Text:='';
 edit5.Text:='';
 edit6.Text:='';
 edit7.Text:='';
 edit8.Text:='';
 edit9.Text:='';
 edit10.Text:='';
 edit11.Text:='';
 edit12.Text:='';
 edit13.Text:='';
 edit14.Text:='';
 edit15.Text:='';
 combobox1.Text:='';
 usenode:=treeview1.Items.GetFirstNode;
 usenode.Collapse(true);
 usenode1:=treeview2.Items.GetFirstNode;
 usenode1.Collapse(true);
 edit1.SetFocus;
 image2.Visible:=false;
 image3.Visible:=true;
 form8.showmodal;
end;
procedure TForm6.Image3MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  image2.Visible:=true;
  image3.Visible:=false;
end;

procedure TForm6.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  image3.Visible:=true;
  image2.Visible:=false;
end;

end.

⌨️ 快捷键说明

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