Topic: Adding Current DateTime to database when updating an entry
I am trying to add the current DateTime to database field when updating an entry. I originally tried to do it with a date time picker but it wouldn't automatically pull the current datetime. So I switched to trying my hand a scripting. I wrote this one here with the help of many other articles but after I close the form it updates all entries in my database not just the one I am working on. I know I am missing something but I am not super knowledgeable about Delphi. I know it must be missing a WHERE statement or some var function, but I cannot figure it out. Any help will be greatly appreciated.
My code:
procedure frmPatient_OnClose (Sender: string; Action: string);
begin
SQLExecute('UPDATE patient SET date_updated = "' + FormatDateTime('yyyy-mm-dd hh:mm:ss.zzz', Now) + '" ');
end;
begin
end.