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; Query6.Next;
end;
end;
Escribí el ejemplo sobre la marcha y no está probado, no des por sentado su correcto funcionamiento.
Saludos