Trying to modify read-only field

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
tfiliano
Posts: 2
Joined: Fri 24 Aug 2012 20:26

Trying to modify read-only field

Post by tfiliano » Fri 24 Aug 2012 20:39

Hi,

I have a same problem with topic http://forums.devart.com/viewtopic.php?t=18131, but, I'm using Interbase Data Access, and all the time i want to edit a record in my client data set (TClientDataSet) the application show's the message "Trying to modify read-only field.". I dont intend to edit the record to save on databse, I only want to edit record and post in memory.

Can you please help me?

My project works like this:
-> TIBCConnection->TBCQuery->TDataSetProvider->TClientDataSet
and my function is:

Code: Select all

function ReturnData(sSQL: string): OleVariant
begin
  clientDataSet.Close;
  ibcquery1.SQL.Clear;
  ibcquery1.SQL.Add(sSQL);
  clientDataSet.Open;

  result := clientdataset.Data;
end;
Really thanks.

ZEuS
Devart Team
Posts: 240
Joined: Thu 05 Apr 2012 07:32

Re: Trying to modify read-only field

Post by ZEuS » Thu 30 Aug 2012 12:24

When you select some computed fields from the database, the TField.ReadOnly property for such fields in the clientDataSet and ibcquery1 components is set to True by default (according to the default ibcquery1.Options.SetFieldsReadOnly property value).
If you set the TField.ReadOnly property to False for these fields in the clientDataSet component and try to modify them, you will receive the "Trying to modify read-only field" error on the post attempt.
To avoid the error you should set the ibcquery1.Options.SetFieldsReadOnly property to False.

tfiliano
Posts: 2
Joined: Fri 24 Aug 2012 20:26

Re: Trying to modify read-only field [SOLVED]

Post by tfiliano » Thu 30 Aug 2012 12:45

"To avoid the error you should set the ibcquery1.Options.SetFieldsReadOnly property to False."

It's run great!

Thanks!!!

Post Reply