LargeInt Fields

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
adoniram
Posts: 22
Joined: Wed 03 Feb 2010 22:16

LargeInt Fields

Post by adoniram » Mon 21 Feb 2011 17:52

After update unidac to 3.60.0.15 version we cannot access LargeInt field with Value property. Instead we have to do AsInteger to work.

If we use Table.FieldByName('LargeIntField').Value it raises "Cannot access field 'LargeIntField' as type Variant" error.

On prior version (3.0.0.9) it's not happened.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Tue 22 Feb 2011 08:27

Hello,

Please specify the name of your database.

adoniram
Posts: 22
Joined: Wed 03 Feb 2010 22:16

Post by adoniram » Thu 24 Feb 2011 16:50

SQL Server.

AndreyZ

Post by AndreyZ » Fri 25 Feb 2011 08:19

This error raises by the TLargeintField class and it depends only on the Delphi version you are using. Starting with Delphi 2005 you won't get such error.

adoniram
Posts: 22
Joined: Wed 03 Feb 2010 22:16

Post by adoniram » Fri 25 Feb 2011 17:40

But before unidac update it works.
Why?

AndreyZ

Post by AndreyZ » Mon 28 Feb 2011 13:16

If you don't use persistent fields, you should use the following code:

Code: Select all

TLargeintField(Table.FieldByName('LargeIntField')).Value
In this way you determine that Delphi must use the TLargeintField.Value property that is defined in the following way:

Code: Select all

property Value: Largeint read GetAsLargeint write SetAsLargeint;
In this case there will be no error. If you don't do this, Delphi will invoke the TField.SetAsVariant method, and this method will invoke the TLargeintField.SetVarValue method that is defined in the following way:

Code: Select all

procedure TLargeintField.SetVarValue(const Value: Variant);
begin
  raise AccessError('Variant'); // here this error is raised
end;
If you use persistent fields, you should use the following code:

Code: Select all

TableLargeIntField.Value
In this case the TLargeintField.SetAsLargeint will be invoked and there will be no error.

adoniram
Posts: 22
Joined: Wed 03 Feb 2010 22:16

Post by adoniram » Tue 01 Mar 2011 18:07

Ok,
Thanks!.

AndreyZ

Post by AndreyZ » Wed 02 Mar 2011 07:59

Feel free to contact us if you have any further questions about UniDAC.

Post Reply