Topic: SQLExecute

Не могу поменять статус задачи запросом SQLExecute

procedure Form1_Button8_OnClick (Sender: TObject; var Cancel: boolean);   
begin
    SQLExecute('UPDATE table SET id_status = 1 WHERE id='+Form1.TableGrid1.sqlValue);
    Form1.TableGrid1.dbUpdate;
end;

Подскажите где тут ошибка

Post's attachments

Attachment icon Проект2.rar 304.18 kb, 67 downloads since 2023-07-11 

Re: SQLExecute

Hi,
The error is because you have actually given the table the name  'table'  (which is a reserved word);  I have simply changed it from 'table' to 'tablex' and that fixes the problem.
It's never a good idea to use 'table' as a table name or 'field' as a field name etc (I notice that you also use the word 'date' for your date field which isn't a good idea either but in this case it hasn't produced an error).
Regards,
Derek.

Post's attachments

Attachment icon project2 fixed.zip 348.95 kb, 78 downloads since 2023-07-11 

Re: SQLExecute

derek wrote:

Hi,
The error is because you have actually given the table the name  'table'  (which is a reserved word);  I have simply changed it from 'table' to 'tablex' and that fixes the problem.
It's never a good idea to use 'table' as a table name or 'field' as a field name etc (I notice that you also use the word 'date' for your date field which isn't a good idea either but in this case it hasn't produced an error).
Regards,
Derek.

Derek, спасибо огромное за помощь.
Все работает, твои предложения очень помогли.