sql:='select * from table where ';
if edit5.text<>'' then
sql=sql+' 藥品名稱='+''''+edit5.text+''''+' and ';
if edit2.text<>'' then
sql=sql+' 進貨廠家='+''''+edit2.text+''''+' and ';
if (edit3.text<>'')and (edit6.text<>'') then
sql=sql+' 銷售單價 between '+''''+ edit3.text +''''+' and'+''''+ edit6.text +''''+ ' and ';
if (edit4.text<>'')and (edit7.text<>'') then
sql=sql+' 進貨單價 between '+''''+ edit4.text +''''+' and'+''''+ edit7.text +'''';
query.sql.clear;
query.sql.add(sql);
query.open;