一个字段pxsj  日期格式
要求过滤条条 pxsj的年等于edit.text
如何写过滤表达式

解决方案 »

  1.   

    不能用sql ,用的是tclientdatset 在本地cds文件 只能用filter
      

  2.   

    Filter := 'pxsj > ' + inttostr(strtoint(edit.Text) - 1) + '-12-31' +
        ' and pxsj < ' + inttostr(strtoint(edit.Text) + 1) + '-01-01';
    笨办法,应该能用吧
      

  3.   

    with adoquery1 do
    begin
      filtered := false;
      Filter := format(' year(pxsj) = %s ',[edit1.text]);
      Filtered := true;
    end;
      

  4.   

    table1.filtered:=true;
     if checkbox1.checked then
      table1.filter:=format('类别'+'='+'''%S''',[edit1.text]);用一dbgrid控件与table相连,过滤结果将显示在里面table1.filtered:=false;后可以重新进行新的过滤