Ver Mensaje Individual
  #1  
Antiguo 28-07-2008
douglas douglas is offline
Miembro
 
Registrado: jul 2007
Posts: 145
Reputación: 17
douglas Va por buen camino
Exclamation error con mas de dos querys en un boton

hola chicos miren aqui con una duda, estaba creando unas consultas para mi programa, basicamente son sumatorias de las tablas, pero al crear la sumatoria de mi tercer tabla me da el siguient error

error de sintaxis falta operador en sum(imp)

el codigo es el siguiente:
Código Delphi [-]

adoquery1.Close;
     adoquery1.SQL.Clear;
     adoquery1.SQL.Add('select sum(ganancia) from diario');
     adoquery1.SQL.Add('where fecha between :Fechain and :Fechafin');
     adoquery1.Parameters.ParamByName('Fechain').Value:=datetimepicker1.DateTime;
     adoquery1.Parameters.ParamByName('Fechafin').Value:=datetimepicker2.DateTime;
     adoquery1.Open;
     a:=adoquery1.Fields[0].AsFloat;
     adoquery1.Close;
     edit1.Text:=floattostr(a);

     adoquery1.Close;
     adoquery1.SQL.Clear;
     adoquery1.SQL.Add('select sum(capital) from diario');
     adoquery1.SQL.Add('where fecha between :Fechain and :Fechafin');
     adoquery1.Parameters.ParamByName('Fechain').Value:=datetimepicker1.DateTime;
     adoquery1.Parameters.ParamByName('Fechafin').Value:=datetimepicker2.DateTime;
     adoquery1.Open;
     b:=adoquery1.Fields[0].AsFloat;
     adoquery1.Close;
     edit2.Text:=floattostr(b);

     adoquery1.Close;
     adoquery1.SQL.Clear;
     adoquery1.SQL.Add('select sum(imp) from diario');
     adoquery1.SQL.Add('where fecha between :Fechain and :Fechafin');
     adoquery1.Parameters.ParamByName('Fechain').Value:=datetimepicker1.DateTime;
     adoquery1.Parameters.ParamByName('Fechafin').Value:=datetimepicker2.DateTime;
     adoquery1.Open;
     c:=adoquery1.Fields[0].AsFloat;
     adoquery1.Close;
     edit3.Text:=floattostr(c);
Responder Con Cita