1

I use the next chain

TADOQuerry->TDataSetProvider->TClientDataSet

to got data for Items and ItemType table and work with it offline. Item TADOQuery's SQL property contains a simple query

select i.ID,i.Name, i.TypeID, i.Qnty, i.Price, it.TypeName 
from Items i join ItemType it on (it.ID = i.TypeID)

ItemType's even simpler:

select * from ItemType

now - for cdsItems I modify TypeName field to be an look-up field and chain it to cdsItemType - nothing uncommon - and bound cdsItems to a grid. But when I try to modify data through using combobox in grid - it throws an error "Trying to modify read-only field".

I set to all fields of both TCliendDataSet ReanOnly:= false. Also, after I got data into TClientDataSets - using an for - I set again to all fields ReadOnly:=False. But even that I still got "Trying to modify read-only field".

Used database is MS SQL Server 2005 Express edition.

DreadAngel
  • 772
  • 11
  • 30

1 Answers1

2

FOUND!!!!

The bug where located in the type of TypeID column of GetItems query (ADOQuery type) - when I loaded all the field into it - the TypeID where added as TAutoIncField - when I changed it to TIntegerField - everything goes well.

DreadAngel
  • 772
  • 11
  • 30
  • Awesome answer. To fix my problem, I edited both the .pas and the .dfm to redefine the TField definition as TIntegerField instead of TAutoIncField so that Delphi would allow me to assign values to the TClientDataSet field. I mean, why should I not be able to do that if I want to!? – Freddie Bell Jan 11 '17 at 13:28