Diferencia entre SQL.Add y SQL.Text
Publicado por Judit (45 intervenciones) el 15/06/2006 01:15:45
Buenas noches!
Mi pregunta es si existe alguna diferencia en utilizar SQL.ADD y SQL.Text, ya que tengo una sentencia que al utilizarla con SQL.Text no me da ningun problema pero al utilizarla con SQL.Add me da un error.
La sentencia es la siguiente:
Con SQl.Add
Query2.Sql.Add('SELECT Cod_Prod, Descripcion, SUM(cantidad) AS CantidadT, SUM(SubTotal) AS Sub, SUM(Descuento) AS DescuentoT, SUM(Total) AS TotalT FROM QVentaC QVentaC ');
Query2.Sql.Add('Where Fecha_Emision between :PFechad and :PFechah');
Query2.SQL.Add('and GROUP BY Cod_Prod, Descripcion');
Con SQL.Text
Query2.SQL.Text := 'SELECT Cod_Prod, Descripcion, SUM(cantidad) AS CantidadT, SUM(SubTotal) AS Sub, SUM(Descuento) AS DescuentoT, SUM(Total) AS TotalT FROM QVentaC QVentaC Where Fecha_Emision between :PFechad and :PFechah GROUP BY Cod_Prod, Descripcion';
El error que me muestra utilizando SQL.Add es este:
Project LUIP.exe raised exception class EDBEngineError with message
'General SQl error.
[Microsoft][ODBC Microsoft Access Driver] Syntax error. in query expresion
'Descripcion
Select Cod_Prod'.'. Process stopped. Use Step or Run to continue.
Estoy utilizando access 2003 y delphi 7
Hay alguna diferencia o algo que no estoy tomando en cuenta?
Gracias anticipadas.
Mi pregunta es si existe alguna diferencia en utilizar SQL.ADD y SQL.Text, ya que tengo una sentencia que al utilizarla con SQL.Text no me da ningun problema pero al utilizarla con SQL.Add me da un error.
La sentencia es la siguiente:
Con SQl.Add
Query2.Sql.Add('SELECT Cod_Prod, Descripcion, SUM(cantidad) AS CantidadT, SUM(SubTotal) AS Sub, SUM(Descuento) AS DescuentoT, SUM(Total) AS TotalT FROM QVentaC QVentaC ');
Query2.Sql.Add('Where Fecha_Emision between :PFechad and :PFechah');
Query2.SQL.Add('and GROUP BY Cod_Prod, Descripcion');
Con SQL.Text
Query2.SQL.Text := 'SELECT Cod_Prod, Descripcion, SUM(cantidad) AS CantidadT, SUM(SubTotal) AS Sub, SUM(Descuento) AS DescuentoT, SUM(Total) AS TotalT FROM QVentaC QVentaC Where Fecha_Emision between :PFechad and :PFechah GROUP BY Cod_Prod, Descripcion';
El error que me muestra utilizando SQL.Add es este:
Project LUIP.exe raised exception class EDBEngineError with message
'General SQl error.
[Microsoft][ODBC Microsoft Access Driver] Syntax error. in query expresion
'Descripcion
Select Cod_Prod'.'. Process stopped. Use Step or Run to continue.
Estoy utilizando access 2003 y delphi 7
Hay alguna diferencia o algo que no estoy tomando en cuenta?
Gracias anticipadas.
Valora esta pregunta


0