StevenK,
I've fiddled with this for about an hour now and tried various ways to do this using just SQL tokens. It appears that Local SQL doesn't provide a function (or keyword) that returns the current date.
You best best is to pass the current date as a parameter to your query. If you're using SQL, I'd use a SQL expression to accomplish this. For example:
Code:
method pushButton(var eventInfo Event)
var
db Database
sqlVar SQL
tv TableView
endVar
const
ANS = ":PRIV:ANSWER.DB"
endConst
db.open()
sqlVar = SQL
select *
from "datetest.db" d
where
d."Date" = ~( "\"" + string( date() ) + "\"" )
endSQL
if not SQLVar.executeSQL( db, ANS ) then
errorShow( "oops" )
else
tv.open( ANS )
endIf
endMethod
If memory serves, you're actually using Delphi (and, if so, should have posted the question in that forum), so the above code won't help much.
However, you should be able to use a query parameter to pass the current date into the query. Something like this should work:
Code:
procedure TForm1.Button1Click(Sender: TObject);
begin
with Query1 do
begin
if active then close;
Params[0].AsDate := Sysutils.Date;
Active := TRUE;
end;
end;
The SQL statement attached to Query1 is:
Code:
select
*
from
"datetest.db" d
where
d."Date" = :qpCurrentDate
Now, you can refer to the parameter in different ways, but this at least shows the approach I'd probably use.
I'll admit that it's not ideal, but it seems to be the best way to approach the problem at this point.
Hope this helps...
-- Lance