SQLString:= 'select * from table1 where ';
if RadioButton1.Checked then
SQLString:= SQLString + 'name = ' + edit1.text
else if RadioButton2.Checked then
SQLString:= SQLString + 'Sex = ' + edit2.text;
with query1 do begin
active:=false; //关闭当前查询
sql.clear; //清除以前的SQL语句
sql.add('select field1,field2,field3... from tbname where');
sql.add('where field1>'+edit1.text);//field1为int字段。
………… //根据情况,任意添加SQL服务器所支持的SQL语句
ExecSQL;
end;