var
i,j:integer;
ybqh:Tybqh;
keytodq:array of string;
listitem:Tlistitem;
begin
setlength(keytodq,maxkey+1);
if trim(edit1.text)='' then
begin
showmessage('请输入关键字!');
exit;
end;
for i:=0 to treeview1.Items.Count -1 do
begin
j:=integer(treeview1.Items.Data^);
keytodq[j]:=treeview1.Items.Text;
end;
listview1.Items.BeginUpdate ;
listview1.Items.Clear ;
j:=0;
sfile.Position :=datapos;
while sfile.Read(ybqh,sizeof(Tybqh))>0 do
begin
if ybqh.key <0 then continue;
if (mh.Checked and ((ckdqmc.Checked and (ansipos(edit1.text,ybqh.mc)>0))
or (ckdqpy.Checked and (pos(uppercase(edit1.text),getpy(ybqh.mc))>0))
or (ckyzbm.Checked and (pos(edit1.text,ybqh.yb )>0))
or (ckdhqh.Checked and (pos(edit1.text,ybqh.qh)>0))))
or (jq.Checked and ((ckdqmc.Checked and (edit1.text=ybqh.mc))
or (ckdqpy.Checked and (uppercase(edit1.text)=getpy(ybqh.mc)))
or (ckyzbm.Checked and (edit1.text=ybqh.yb ))
or (ckdhqh.Checked and (edit1.text=ybqh.qh))))
then
begin
j:=j+1;
listitem:=listview1.Items.Add ;
listitem.caption:=keytodq[ybqh.key];
listitem.SubItems.Add(ybqh.mc);
listitem.SubItems.Add(ybqh.qh);
listitem.SubItems.Add(ybqh.yb);
listitem.Data:=new(Pkey);
integer(listitem.data^):=sfile.Position -sizeof(Tybqh);
end;
end;
columntosort:=2;
order:=-1;
listview1.AlphaSort ;
listview1.Items.EndUpdate ;
statusbar1.Panels [1].Text :='共'+inttostr(j)+'个';
-------------
上面是一个例子,里面有两个单选框,4个多选框。
JQ和MH是两个单选框,代表精确查询和模糊查询
另四个为CKDQMC,CKDQPY,CKYZBM,CKDHQH ,这四个
字段为你所要查询的字段
ybqh这个是数据库,其他的我也就不解释了,自己看吧
-----------