Page 1 of 1

TVirtualTable throws 'Illegal filter expression'

Posted: Wed 26 May 2010 16:29
by cis-wurzen
TVirtualTable throws 'Illegal filter expression' if value starts with an apostrophe (aka #39 or Chr(39)).

Steps to reproduce:

* Create a new VCL-App.
* Drop a TVirtualTable on Form1. Name it VT.
* Create one field named FIELD with type ftString.
* Fill Data with two records. One with [A], second with ['X] (without the brackets)
* Put a Button on Form1
* Enter code

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
  VT.Open;
  VT.Filter := 'FIELD=' + QuotedStr('A');
  VT.Filtered := True; // works

  VT.Filtered := False;
  VT.Filter := 'FIELD=' + QuotedStr(#39 + 'X');
  VT.Filtered := True; // crashes
end;
* Run and press button.

Versions: Delphi 2010 ODAC 6.90.0.57

Posted: Fri 28 May 2010 06:27
by bork
Hello

Thank you for the information. We have reproduced this problem and fixed it. This fix will be included in the next (6.90.0.59) ODAC build.

Now you can use the expression VT.Filter := 'FIELD="''''X"' instead of the expression VT.Filter := 'FIELD=' + QuotedStr(#39 + 'X')