Serge_Bliznykov
begin
if (Length(Trim(edit1.text)) = 0) and
(Length(Trim(edit2.text)) = 0) then Exit;
with q1 do
begin
close;
sql.clear;
sql.Add('select *from tes where ');
if (Length(Trim(edit1.text))>0 then
sql.Add(' fio like ' + quotedStr('%'+Trim(edit1.text)+'%') );
if ((Length(Trim(edit1.text))>0) and (Length(Trim(edit2.text))>0 then
sql.Add(' and ');
if (Length(Trim(edit2.text))>0 then
sql.Add(' name like ' + quotedStr('%'+Trim(edit2.text)+'%') );
open;
end;
идея понятна?
Stilet
sql.Add('select *from tes where 1=1 ');
if Edit1.Text<>'' then sql.Add(' and fio like %'+QuotedStr(Edit1.Text)+'% ');
if Edit2.Text<>'' then sql.Add(' and name like %'+QuotedStr(Edit2.Text)+'% ');