开发者

is possible filter a TClientDataset using a insensitive case?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜