Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   SQL (https://www.clubdelphi.com/foros/forumdisplay.php?f=6)
-   -   Query y Parámetros (https://www.clubdelphi.com/foros/showthread.php?t=17941)

gluglu 26-01-2005 18:14:36

Query y Parámetros
 
Hola Amigos !

Este código :
Código Delphi [-]
DateC := EncodeDate(Year,Month,Day);
IBQueryCheck.SQL.Clear;
IBQueryCheck.SQL.Add('Select * from SEASONS');
IBQueryCheck.SQL.Add('where DATEFROM <= :DateC and :DateC <= DATETO');
IBQueryCheck.ParamByName('DateC').Value := DateC;
IBQueryCheck.Open;
me devuelve el error:
Código Delphi [-]
[Error] E2010 Incompatible types: 'Variant' and 'TDate'
Una ayudita por favor ....

roman 26-01-2005 18:31:06

Pues es raro, debieran ser compatibles. Si 'DateC' es un campo de tipo Date, ¿no te funciona poner

IBQueryCheck.ParamByName('DateC').AsDate := DateC;

en lugar de

IBQueryCheck.ParamByName('DateC').Value := DateC;

?

// Saludos

gluglu 26-01-2005 18:45:49

Gracias Roman una vez más !

lucianojdg 31-01-2005 13:55:00

RE: Query y Parámetros
 
Proba con esto:

DateC := EncodeDate(Year,Month,Day);
IBQueryCheck.SQL.Clear;
IBQueryCheck.SQL.Add('Select * from SEASONS');
IBQueryCheck.SQL.Add('where DATEFROM <= :DateC and DATETO >= :DateC');
IBQueryCheck.ParamByName('DateC').AsDate := DateC;
IBQueryCheck.Open;

Otra forma de hacer los mismo es la sigueinte:

DateC := EncodeDate(Year,Month,Day);
IBQueryCheck.SQL.Clear;
IBQueryCheck.SQL.Add('Select * from SEASONS');
IBQueryCheck.SQL.Add('where ' + Chr(39) + DateToStr(DateC) + Char(39) +
' Between DATEFROM and DATETO');
IBQueryCheck.Open;


Nota: Hay un espacio antes del Between

Saudos


Luciano


La franja horaria es GMT +2. Ahora son las 01:52:22.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi