直接写:  
  Tabel1->Filter="FieldName='aaa'";     //aaa为字符类字段  
  Tabel1->Filter="FieldName=aaa";         //aaa为数字类字段  
  使用变量  
  1.字符类型  
  AnsiString   S;  
  S="aaa"   ;//给变量赋值  
  Tabel1->Filter=Format("Filter='%s'",OPENARRAY(TVarRec,(S)));  
  2.数字类型  
  int   S;  
  S=1;     //给变量赋值  
  Tabel1->Filter=Format("Filter=%s",OPENARRAY(TVarRec,(S)));  
  最后要将Table1->Filtered设置为true过滤才好用。 
  或者:  
  adotable1.Filter:='work_code='''+trim(label1.caption)+'''';  
  adotable1.Filtered:=true;  
  试试这个:  
  adotable1.Filter:='work_code='''+label1.caption+'''';  
  adotable1.Filtered:=true;  
  /////
  adotable.filiter:=strname + '='+quotedstr(strif);
  ////
        TDataSetState   =   (dsInactive,   dsBrowse,   dsEdit,   dsInsert,   dsSetKey,  
          dsCalcFields,   dsFilter,   dsNewValue,   dsOldValue,   dsCurValue,   dsBlockRead,     dsInternalCalc,   dsOpening);

相关文章:

  • 2021-08-08
  • 2022-12-23
  • 2021-11-02
  • 2022-12-23
  • 2022-01-09
  • 2021-11-17
  • 2021-10-19
  • 2022-12-23
猜你喜欢
  • 2021-06-02
  • 2022-12-23
  • 2022-01-30
  • 2022-12-23
  • 2021-04-04
  • 2021-11-26
  • 2021-11-29
相关资源
相似解决方案