Solved

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

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi XE10, MySQL Query 4 143
Delphi selector screen 2 79
Is anyone willing to have a look through this code and help debug? 25 75
Tidtcpserver listening on multiports? 1 27
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

777 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