Trying to modify read-only field.
Posted: Tue 13 Mar 2007 14:27
I have a client data set populated using a stored procedure. Then the client data set is modified by user, but not written back. All worked OK under BDE but, after I switched to CoreLab, I started to get the read-only field error.
Although I set the individual field as .readonly := false, I still get the "Trying to modify read-only field." error.
The field is a calcuated field. If I modify the stored procedure, first calculate the field and write into a temporary table, then return with a join all works fine. Something like this:
create procedure spTest
as begin
// age read only here.
select ID, Name, Age+1 as Age from testtable
end
go
create procedure spTest
as begin
// age can be modified here.
declare @a table (id int, age int null)
insert into @a(id, age)
select ID, Age+1 as Age from testtable
select T.ID, T.Name, A.Age as Age
from testtable T
JOIN @a A ON A.ID = T.ID
end
But as you can see, this is a lot of work, and sometimes not even feasible.
Any suggestions?
Although I set the individual field as .readonly := false, I still get the "Trying to modify read-only field." error.
The field is a calcuated field. If I modify the stored procedure, first calculate the field and write into a temporary table, then return with a join all works fine. Something like this:
create procedure spTest
as begin
// age read only here.
select ID, Name, Age+1 as Age from testtable
end
go
create procedure spTest
as begin
// age can be modified here.
declare @a table (id int, age int null)
insert into @a(id, age)
select ID, Age+1 as Age from testtable
select T.ID, T.Name, A.Age as Age
from testtable T
JOIN @a A ON A.ID = T.ID
end
But as you can see, this is a lot of work, and sometimes not even feasible.
Any suggestions?