Ver Mensaje Individual
  #3  
Antiguo 09-03-2019
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola.

Agregando a lo que te aconseja Casimiro, siempre que puedas, usa parámetros para evitar la inyección SQL.

Algo similar a esto:
Código Delphi [-]
var
  qconsr : TQuery;
  cont   : Integer;
begin
  Query6.First;
  while not Query6.Eof do
  begin
    for cont := 0 to Query6.RecordCount -1 do
    begin
      qconsr := TQuery.create(nil);
      try
        qconsr.DatabaseName := Md_comun.BASEDATOS.DatabaseName;
        qconsr.SQL.Clear;
        qconsr.SQL.Add('UPDATE PAGO SET DETER = P1 WHERE NROCREDITO = P2');
        qconsr.SQL.Add('AND DOCUMENTO = P3 AND CONSECUTIVO = P4');
        qconsr.ParamByName('P1').AsFloat  := v1;
        qconsr.ParamByName('P2').AsString := Query6.FieldByName('nro_credito').AsString;
        qconsr.ParamByName('P3').AsString := Query6.FieldByName('documento').AsString;
        qconsr.ParamByName('P4').AsString := Query6.FieldByName('consecutivo').AsString;
        qconsr.ExecSQL;
      finally
        qconsr.Free;
      end;
    end; // Fin For
    Query6.Next;
  end;
end;
Escribí el ejemplo sobre la marcha y no está probado, no des por sentado su correcto funcionamiento.

Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita