Page 1 of 1

Trying to modify read-only field

Posted: Fri 24 Aug 2012 20:39
by tfiliano
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.

Re: Trying to modify read-only field

Posted: Thu 30 Aug 2012 12:24
by ZEuS
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.

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

Posted: Thu 30 Aug 2012 12:45
by tfiliano
"To avoid the error you should set the ibcquery1.Options.SetFieldsReadOnly property to False."

It's run great!

Thanks!!!