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