I'm using firedac with Delphi 10.3 with Interbase, when i use an update SQL statement in more forms it will work perfect.
But in one form i do exact the same the table is not updated, but when i close the form and close the application the update is done to the database.
I'm completely lost and i don't know how this is possible.
I found a part of the problem:
When i use Commit it works, but when there is a open command between two update statements i need to use StartTransAction before the open en Commit after the open. Then the second update works:
DM_IB.IBF_VHE.ExecSQL('Update BB_ASML_FORECAST set Uren_Montage = 100, Uren_Berekend = ''Ja'' ' +
'where AANMAAK_DATUMTIJD = ''19-10-2022 10:12:38'' and ItemCode = ''4022.472.18632'' ') ;
DM_IB.IBF_VHE.Commit ;
ShowMessage('1') ; // Works no problems
MEM_VPA.DisableControls ;
MEM_Fouten.DisableControls ;
Post_Confirm := False ;
Try
MEM_VPA.Close ;
MEM_VPA.Open ;
MEM_VPA.EmptyTable ;
MEM_Fouten.Close ;
MEM_Fouten.Open ;
MEM_Fouten.EmptyTable ;
With TFDQuery.Create(nil) do
Try
Connection := DM_IB.IBF_VHE ;
SQL.Text := 'select * from PL_CAPACITEIT_NPW where ' +
'(jaar = ' + FormatDateTime('yyyy', now()) + ' and ' +
'Weeknummer > ' + IntToStr(WeekofTheyear(Now())) + ') or ' +
'(jaar = ' + FormatDateTime('yyyy', IncYear(Now())) + ' and ' +
'weeknummer < ' + IntToStr(52 - (52 - WeekofTheyear(Now()))) + ') order by jaar, weeknummer' ;
DM_IB.IBF_VHE.StartTransaction ; // when this line is nod add and the commit the update below is not working till i end the application
Open ;
DM_IB.IBF_VHE.Commit ;
DM_IB.IBF_VHE.StartTransaction ;
DM_IB.IBF_VHE.ExecSQL('Update BB_ASML_FORECAST set Uren_Montage = 100, Uren_Berekend = ''Ja'' ' +
'where AANMAAK_DATUMTIJD = ''19-10-2022 10:12:38'' and ItemCode = ''4022.472.88135'' ') ;
DM_IB.IBF_VHE.Commit ;
ShowMessage('2') ; // Works only when de above open command is between a transacion.
Thanks in advice,