Pregunta

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.

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top