开发者

is possible filter a TClientDataset using a insensitive case?

开发者 https://www.devze.com 2023-01-21 20:12 出处:网络
i need to filter a TClientDataset,actually i\'am using this code. if Value<>\'\' then begin ClientDataSet1.DisableControls;

i need to filter a TClientDataset, actually i'am using this code.

  if Value<>'' then
  begin
      ClientDataSet1.DisableControls;
      try
        ClientDataSet1.Filtered := False;
        ClientDataSet1.Filter   := 'Value LIKE ' + QuotedStr('%'+Value+'%');
        ClientDataSet1.Filtered := True;
      finally
   开发者_运维百科     ClientDataSet1.EnableControls;
      end;
  end;

but the filter is working in case-sensitive mode, is posible filter the record ignoring the case?


you must use the FilterOptions property with the foCaseInsensitive value.

  ClientDataSet1.DisableControls;
  try
    ClientDataSet1.Filtered := False;
    ClientDataSet1.FilterOptions := [foCaseInsensitive];
    ClientDataSet1.Filter   := 'Value LIKE ' + QuotedStr('%'+Value+'%');
    ClientDataSet1.Filtered := True;
  finally
    ClientDataSet1.EnableControls;
  end;
0

精彩评论

暂无评论...
验证码 换一张
取 消