Por lo general, este tipo de problemas se resuelven usando consultas parametrizadas. Pon tu consulta así:
Código SQL
[-]
select Carne, Nombre, Apellido1, Apellido2, Fecha, VisitaA, HoraEntrada
from Dentro
where HoraEntrada between :inicio and :fin
order by fecha
Los dos puntos en
:inicio y
:fin indican que
inicio y
fin son parámetros. El valor de los parámetros los asignas antes de abrir la consulta:
Código Delphi
[-]
ADOQuery1.Parameters.ParamByName('inicio').Value := HoraInicio;
ADOQuery1.Parameters.ParamByName('fin').Value := HoraFin;
Aquí, HoraInicio y HoraFin deben ser valores de tipo TTime. Puedes obtenerlos a partir de una cadena de caracteres con la función StrToTime:
Código Delphi
[-]
HoraInicio := StrToTime('08:00');
HoraFin := StrToTime('13:00');
Como estás trabajando con ADO, debes, además, especificar el tipo de datos de los parámetros:
Código Delphi
[-]
ADOQuery1.Parameters.ParamByName('inicio').DataType := ftTime;
ADOQuery1.Parameters.ParamByName('fin').DataType := ftTime;
En resumen, tendrías algo así;
Código Delphi
[-]
var
HoraInicio, HoraFin: TTime;
begin
...
HoraInicio := StrToTime('08:00');
HoraFin := StrToTime('13:00');
ADOQuery1.Parameters.ParamByName('inicio').DataType := ftTime;
ADOQuery1.Parameters.ParamByName('fin').DataType := ftTime;
ADOQuery1.Parameters.ParamByName('inicio').Value := HoraInicio;
ADOQuery1.Parameters.ParamByName('fin').Value := HoraFin;
ADOQuery1.Open;
end;
// Saludos