Solved

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

Posted on 1998-11-12
2
155 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

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…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…

752 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