Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

SQL and Dates In Delphi

hmvdmhmvdm Member Posts: 1
Hey
I'm a matric pupil writing a database delphi project for computer studies. It is a bussiness that hires out products. I'm trying to Display all bookings in a table bookings where a product is out/not available for a certain day. In the SQL property of a ADOQuery I wrote the following:

SELECT * FROM Bookings WHERE Date BETWEEN Date_Out and Date_In

The program displays no records even if I have check manually that there are such records.The DBGrid displays all the records when I scrap the where part and it also works for other Queries, so the problem must be in the date part. I've tried to add DateToStr and StrTodate but it doesn't help. Please help!!

Comments

  • j4460j4460 Member Posts: 1
    : Hey
    : I'm a matric pupil writing a database delphi project for computer
    : studies. It is a bussiness that hires out products. I'm trying to
    : Display all bookings in a table bookings where a product is out/not
    : available for a certain day. In the SQL property of a ADOQuery I
    : wrote the following:
    :
    : SELECT * FROM Bookings WHERE Date BETWEEN Date_Out and Date_In
    :
    : The program displays no records even if I have check manually that
    : there are such records.The DBGrid displays all the records when I
    : scrap the where part and it also works for other Queries, so the
    : problem must be in the date part. I've tried to add DateToStr and
    : StrTodate but it doesn't help. Please help!!
    :

    How are you trying to display? Do you have the DataSet set up?

    - Jason

  • szluhaszluha Member Posts: 29 ✭✭
    : SELECT * FROM Bookings WHERE Date BETWEEN Date_Out and Date_In

    Try placing the dates between # (hash) symbols.
Sign In or Register to comment.