Topic: Return value from sql update statement

Hi

I am using an Update sql statement and wish to capture a return value if the update was sucesufull or how many lines were updated.

I am using a script like this : reply:=sqlexecute('UPDATE EXAMPLE SET  NAME = "11333311" WHERE id = "3"');

The update is sucesfull in the table but the reply variable is always empty or zero.

How can I get a reply about the update process?

Thank you
George

Re: Return value from sql update statement

if you are using sqlite use

sqlexecute('UPDATE EXAMPLE SET  NAME = "11333311" WHERE id = "3"');
reply:=sqlexecute('SELECT changes()');

for mysql, use

sqlexecute('UPDATE EXAMPLE SET  NAME = "11333311" WHERE id = "3"');
reply=sqlexecute('SELECT ROW_COUNT()');
brian

Re: Return value from sql update statement

procedure Form1_Button5_OnClick (Sender: TObject; var Cancel: boolean);
begin
   SQLExecute('UPDATE q SET q="" WHERE id=1');
    if (SQLExecute('SELECT q FROM q WHERE id=1')= Form1.Edit5.Text) Then showmessage('Yes') else showmessage('No');
end;

Re: Return value from sql update statement

Thank you.

Both the solutions are good for what I am doing.
Thank you again for answering so fast.

Best regards
George