Page 1 of 1

Cannot change field value of join

Posted: Wed 23 Nov 2011 09:57
by Thomas J.
Hello all

I have a join like this (MySQL)

Code: Select all

SELECT a.*, f.n_status
FROM t_auftrag a
     LEFT JOIN t_auftrag_user_flag f ON a.n_id = f.n_auftrag_id
and I want tot change the value of field n_status.
These lines of code are forcing the error "Cannot change field"

Code: Select all

	DsAuftrag8->DataSet->Edit();
	DsAuftrag8->DataSet->FieldByName("n_status")->AsInteger = 8;
	DsAuftrag8->DataSet->Post();
The same with TMyQuery is working. Where ist the problem in TUniQuery?
I will write the value manually to the database in case of that the user has changed the value of n_status, but right now the user is not even able to change the value.
Thanks
Thomas

Posted: Thu 24 Nov 2011 14:54
by AndreyZ
Hello,

To solve the problem, you should set the TUniQuery.Options.SetFieldsReadOnly property to False (TMyQuery.Options.SetFieldsReadOnly=False by default).