Page 1 of 1

TVirtualTable and TVariantField

Posted: Wed 16 May 2018 09:52
by serpan
Hello,

I am using UniDAC version 7.2.7 for Delphi XE5 Professional.

I need to create fields of type Variant in the component TVirtualTable:

Code: Select all

  VirtualTable1.FieldDefs.Add('id', ftVariant);
  VirtualTable1.FieldDefs.Add('name', ftVariant);
However, when I access them by property AsVariant, I get error: Access violation...:

Code: Select all

  VirtualTable1.Append;
  VirtualTable1.FieldByName('id').AsVariant := '1';
  VirtualTable1.FieldByName('name').AsVariant := 'String 1';
  VirtualTable1.Post;
Property AsString is works.

Code: Select all

  VirtualTable1.Append;
  VirtualTable1.FieldByName('id').AsString := '1';
  VirtualTable1.FieldByName('name').AsString := 'String 1';
  VirtualTable1.Post;
How can I use the AsVariant property?
Thank you very much.

Sergey.

Re: TVirtualTable and TVariantField

Posted: Wed 16 May 2018 21:39
by ertank
Hello,

That should be

Code: Select all

VirtualTable1.FieldByName('name').Value := 'String 1';

Re: TVirtualTable and TVariantField

Posted: Thu 17 May 2018 03:11
by serpan
Hello,
VirtualTable1.FieldByName('name').Value := 'String 1';
Did not help.

Re: TVirtualTable and TVariantField

Posted: Thu 17 May 2018 13:10
by MaximG
Thank you for the information. We have reproduced the problem and fixed the bug. The fix will be included in the next UniDAC build. Currently, we can send you a night build of UniDAC with the fix. For this, please specify your license number and the exact version of Delphi you are using via the e-support form ( https://www.devart.com the "Support"\"Request Support" menu)