有关库存报警,上限、下限比较的问题
如字段,sl,sx,xx
如何用filter过滤出超过上限,低于下限,数量在上限下限之间的数据
filter := 'sl > sx'
filtered := true;
出错:
---------------------------
Debugger Exception Notification
---------------------------
Project JXC.exe raised exception class EOleException with message '参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。'. Process stopped. Use Step or Run to continue.
---------------------------
OK   Help   
---------------------------

解决方案 »

  1.   

    sx是什么如果是变量
    filter := 'sl >' + sx;
      

  2.   

    全都是字段
    我听说filter不支持 字段与字段之间的比较,是吗
      

  3.   

    我觉得如果要用filter的方式,还是在onFilterRecord事件中写...
    比如
    procedure TForm1.Table1FilterRecord(DataSet: TDataSet;
      var Accept: Boolean);
    begin
      Accept := (DataSet.FieldByName('字段名').AsString = '查找值');
    end;
    如果查找字段或条件不定(比如>,<,=等) 这些用变量控制好了,个人以为而已...
      

  4.   

    我已经用adoquery的sql语句解决了
    但是我想知道,delphi是不是不能用filter实现在onfilterrecord事件中可以实现字段与字段之间的比较吗?如何触发onfilterrecord事件?
      

  5.   

    filtered := sl>sx or sl<xx  超过上限,低于下限
    filtered := sl<sx and sl>xx 数量在上限下限注意数据类型
      

  6.   

    楼上你确认你的代码可以吗?
    我都说了是字段与字段之间的比较delphi帮助里说:
    Filter expressions on remote SQL tables and on client datasets support field comparisons. For example:Field1 > Field2Field comparisons are not supported against local tables (Paradox, dBASE, Access, FoxPro).我的是oracle数据库,应该可以啊
    有没有真正懂得高手啊!!!