组合查询

//checkbox  onlick
  query_lx_lxdm.Enabled:=label_lx_lxdm.Checked;


//判断edit框enable ,生成like
var
  str,like:string;
begin
  like:='';
  if query_lx_lxdm.Enabled then begin
    str:=query_lx_lxdm.Text ;
    if like='' then like:=' where '
    else like:=like+' and ';
    like:=like+' 路线代码 like '+quotedstr('%'+str+'%');
  end;
  if query_lx_lxmc.Enabled then begin
    str:=query_lx_lxmc.Text ;
    if like='' then like:=' where '
    else like:=like+' and ';
    like:=like+' 路线名称 like '+quotedstr('%'+str+'%');

  end;

 query.sql.text:=str;

 query.ExecSQL;

你可能感兴趣的:(组合查询)