Q: What is the correct syntax for Paradox SQL (TQuery) to
enter dates into a datefield?
A: Method #1:
SELECT * FROM "ROD.DB" WHERE DATE >= '07/01/1997'
NOTE: The date format is up to the DB in use. Oracle allows the
DB Administrator to define the date format. My Oracle system
wants this format: '01-jan-1998', but when Oracle sends dates
back to me, it uses a different format!
B: Method #2:
Use a parameter to hold the date.
Query1.SQL.Add('SELECT * FROM "ROD.DB" WHERE DATE >= :StartDate');
Set the date into the paramerter like this:
Query1.Params[0].AsDateTime := Now;
or, do it like this:
Query1.ParamByName('StartDate').AsDateTime := Now;
Then, do a "prepare" to set the get the SQL ready to run:
Query1.Prepare;
Then run it:
Query1.Open;
               (
geocities.com/huanlin_tsai)