Solved

How to include the current date into the query's SQL?

Posted on 1998-11-12
2
157 Views
Last Modified: 2010-04-04
I would like to know how can I include the current date into the query's SQL statement? e.g. I need to get a list of cars that will be returned on current day/specific day from a database using query.... but I cant include the date into the SQL statement....

Can someone please help me?
0
Comment
Question by:blueylam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
dwwang earned 100 total points
ID: 1346692
Just write query1.SQL:='Select * frm yourTable where YourDateField=:DateParam and ....'

Then query1.ParamByName('DateParam').AsDateTime:=DesiredDate;(date type variable)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1346693
hi blueylam,

in addition to dwwang's correct answer,

you can get the currentdate with the  functions date or now

query1.ParamByName('DateParam').AsDateTime:=Now;

meikl
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month8 days, 21 hours left to enroll

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question