我需要过滤一个TClientDataset,实际上我使用这个代码. if Value'' then begin ClientDataSet1.DisableControls; try ClientDataSet1.Filtered := False; ClientDataSet1.Filter := 'Value LIKE ' + QuotedStr('%'+Value+'%'); ClientDataSet
if Value<>'' then begin ClientDataSet1.DisableControls; try ClientDataSet1.Filtered := False; ClientDataSet1.Filter := 'Value LIKE ' + QuotedStr('%'+Value+'%'); ClientDataSet1.Filtered := True; finally ClientDataSet1.EnableControls; end; end;
但是过滤器工作在区分大小写的模式下,是否可以过滤记录忽略的情况?
必须将FilterOptions
属性与foCaseInsensitive值一起使用.
ClientDataSet1.DisableControls; try ClientDataSet1.Filtered := False; ClientDataSet1.FilterOptions := [foCaseInsensitive]; ClientDataSet1.Filter := 'Value LIKE ' + QuotedStr('%'+Value+'%'); ClientDataSet1.Filtered := True; finally ClientDataSet1.EnableControls; end;