Ver Mensaje Individual
  #6  
Antiguo 26-05-2008
egarc egarc is offline
Miembro
 
Registrado: jul 2006
Posts: 60
Reputación: 18
egarc Va por buen camino
Ok, Trabajo con SQL 2005 y Delphi 2007

Hago la siguiente consulta

Código SQL [-]
Select CodigoCliente, Numero, Fecha, Monto 
from FACTURAS
 
where fecha between :Fecha1 and :Fecha2

Luego paso los parámetros, etc.etc.

La consulta me devuelve mas o menos 5,000 registros, y ejecuto el siguiente codigo para sacar el total de la suma del campo MONTO

Código Delphi [-]
Var Total:real;
Begin     total:=0;     
Try        With query1 Do 
Begin             
First;             
While Not EoF Do Begin                 
  Total := Total+ Query1.fielbyName('Monto').AsFloat;                   
Next;             
End;        
End;     Finally    
End;     
Edit1.Text := Floattostr(Total);
End;

Entonces, en el calculo que deseo poner en el edit1 me tarda mucho tiempo, ya que mientras mas registros tenga la consulta, mas tiempo tardará en dar el resultado.

Gracias anticipadas
Responder Con Cita