procedure TCardComplex.btSubmitClick(Sender: TObject);
begin
  MainQuery.Close;
  MainQuery.SQL.Clear;
  MainQuery.SQL.Add('select code,username,sex,dep,job,tel,kind,usemoney');
  MainQuery.SQL.Add('from cardinfo');
  MainQuery.SQL.Add('where code=code');
  if Length(edCardNo.Text)<>0 then
    begin
    MainQuery.SQL.Add('and code=:pcode');
    MainQuery.Parameters.ParamValues['pcode']:=edCardNo.Text;
    end;
  if Length(edName.Text)<>0 then
    begin
    MainQuery.SQL.Add('and username=:pname');
    MainQuery.Parameters.ParamValues['pname']:=edName.Text;
    end;
  if cbSex.Text<>'' then
    begin
    MainQuery.SQL.Add('and sex=:pSex');
    MainQuery.Parameters.ParamValues['psex']:=cbSex.Text;
    end;
  if cbDep.Text<>'' then
    begin
    MainQuery.SQL.Add('and dep=:pDep');
    MainQuery.Parameters.ParamValues['pDep']:=cbdep.Text;
    end;
  if cbJob.Text<>'' then
    begin
    MainQuery.SQL.Add('and job=:pJob');
    MainQuery.Parameters.ParamValues['pJob']:=cbJob.Text;
    end;
   MainQuery.Open;
   Statusbar1.Panels[0].Text:='共找到'+IntToStr(MainQuery.RecordCount)+'条记录';
   btClear.Enabled:=true;
   btReport.Enabled:=true;
   btSubmit.Enabled:=false;
end;你问的是这个?