Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 1998-11-12
2
Medium Priority
?
159 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 400 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

715 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