Page 1 of 1

How can I control which field are being updated?

Posted: Wed 06 Jul 2022 19:02
by Elivaldo
For example:

Code: Select all

SELECT id, name, salary, ‘n’ as modified FROM employees
If I change the fields SALARY and MODIFIED I would receive the error “Unknown column MODIFIED in field list”

OK. One solution would be the use of SQLUpdate property, specifying the sentence for update:

Code: Select all

UPDATE employees SET name = x, salary = y WHERE id = z
But… this implies that the field NAME would be updated even if the only field really changed is SALARY. And this could lead to problem. Imagine that, at the same time, ComputerA changes the field NAME and ComputerB changes the field SALARY. The data from the last computer to apply would prevail.

Could anyone please help me?

Re: How can I control which field are being updated?

Posted: Thu 07 Jul 2022 16:46
by davidmarcus
Not sure I understand the question. If you have multiple clients updating the same data, you need some form of locking. There are various ways to do this.

Re: How can I control which field are being updated?

Posted: Thu 07 Jul 2022 16:58
by Elivaldo
Thanks, David. Putting it simpler: Is there a way to tell TMyQuery not do update a certain field?

Re: How can I control which field are being updated?

Posted: Thu 07 Jul 2022 17:54
by davidmarcus
I don't know. I usually use TMyCommand to do updates. I don't know what TMyQuery can do.

Re: How can I control which field are being updated?

Posted: Thu 07 Jul 2022 22:20
by Elivaldo
Ok, David. Thanks.

Re: How can I control which field are being updated?

Posted: Fri 08 Jul 2022 18:26
by pavelpd
Hey,
Thanks for contacting us!

Kindly note, that we were unable to reproduce the "Unknown column MODIFIED in field list" error you mentioned based on the data you provided.
So could please compose and send us an sample application reproducing the error you have specified with all necessary DDL and DML scripts to create and populate database objects.
You can send all the needed samples via the e-support form: https://www.devart.com/company/contactform.html

Also, please send us the exact list of steps (actions) which leading to the error you indicated.
You can create and send us the screenshot demonstrating the issue.

Additionally, could you please clarify some additional information:
- What version of MyDAC do you have;
- What version of RadStudio;
- What version of the database;