Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > SQL
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 26-01-2005
Avatar de gluglu
[gluglu] gluglu is offline
Miembro Premium
 
Registrado: sep 2004
Ubicación: Málaga - España
Posts: 1.455
Poder: 21
gluglu Va por buen camino
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 <= ateC and ateC <= 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 ....
Responder Con Cita
  #2  
Antiguo 26-01-2005
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Poder: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
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
Responder Con Cita
  #3  
Antiguo 26-01-2005
Avatar de gluglu
[gluglu] gluglu is offline
Miembro Premium
 
Registrado: sep 2004
Ubicación: Málaga - España
Posts: 1.455
Poder: 21
gluglu Va por buen camino
Gracias Roman una vez más !

Última edición por gluglu fecha: 31-01-2005 a las 14:27:59.
Responder Con Cita
  #4  
Antiguo 31-01-2005
lucianojdg lucianojdg is offline
Miembro
 
Registrado: dic 2003
Posts: 42
Poder: 0
lucianojdg Va por buen camino
Smile 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 <= ateC and DATETO >= ateC');
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
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 20:51:59.


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