Cannot change field value of join

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Thomas J.
Posts: 95
Joined: Mon 21 Nov 2005 12:16
Location: Germany

Cannot change field value of join

Post by Thomas J. » Wed 23 Nov 2011 09:57

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

AndreyZ

Post by AndreyZ » Thu 24 Nov 2011 14:54

Hello,

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

Post Reply