Ver Mensaje Individual
  #4  
Antiguo 04-08-2025
emailx45 emailx45 is offline
Miembro
 
Registrado: abr 2025
Posts: 10
Reputación: 0
emailx45 Va por buen camino
Thumbs up

En lugar de usar el método clásico de escanear todos los registros de una tabla con un "WHILE/REPEAT...", utilice una sentencia SQL más eficiente y rápida.

SQL Text => IBQuery, FDQuery, TQuery, UniQuery, etc.. etc.. etc...

' UPDATE <<TABLE>> '
' SET <<Field1 = ValueABC, <<Field2= ValueABC, etc... etc... >>'
' WHERE <<FieldX = XXXXX .... etc. ... etc... >>>

example:

Código Delphi [-]
  try
    try
      if not FDConnection1.InTransaction then
        FDConnection1.StartTransaction;
        //
      FDQuery1.ExecSQL( 'INSERT / DELETE / UPDATE  .......' );
    except
      on E:Exception do
        ShowMessage(E.Message);
    end;
  finally
    if FDConnection1.InTransaction then
      FDConnection1.Commit;
  end;

UPDATE MyTable
SET Name="John", Age=18
Where ((FieldA ='CATALANA') or (FieldA ='NACIONAL')) and (FieldB ='S')
Responder Con Cita