Attempted update of read-only column

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
NicoCallewaert
Posts: 3
Joined: Mon 18 Apr 2016 08:12

Attempted update of read-only column

Post by NicoCallewaert » Mon 18 Apr 2016 08:24

Hi,

I have a SQL statement with 1 computed field on it. I assign values to all fields, no problem so far, but upon post I receive this error "Attempted update of read-only column". I was wondering why the IBCQuery includes the computed field in its update statement? Is there any way to solve this? Setting Options.SetFieldsReadOnly = False doesn't help.

Many thanks in advance !
Nico

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Attempted update of read-only column

Post by ViktorV » Tue 19 Apr 2016 13:39

This error occurs when an UPDATE query contains a computed field. If the UPDATE query was generated in design-time, you should select all fields but computed and re-generate the UPDATE query. If the SQLUpdate property is set to empty string, the computed field will be added to the query only in case you manually assign a value to this field .To prevent the error, set the TField.ReadOnly property to True for this field.

NicoCallewaert
Posts: 3
Joined: Mon 18 Apr 2016 08:12

Re: Attempted update of read-only column

Post by NicoCallewaert » Tue 19 Apr 2016 14:38

Hi Viktor,

Thanks for the reply. There was indeed a value assigned to the computed field. Fixed !

Thanks a lot, Nico

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Attempted update of read-only column

Post by ViktorV » Wed 20 Apr 2016 12:33

It is good to see that the issue has been solved. Feel free to contact us if you have any further questions about IBDAC.

NicoCallewaert
Posts: 3
Joined: Mon 18 Apr 2016 08:12

Re: Attempted update of read-only column

Post by NicoCallewaert » Wed 20 Apr 2016 12:34

Thanks Viktor !

Post Reply