Link to home
Start Free TrialLog in
Avatar of Graeme McGilvray
Graeme McGilvrayFlag for Australia

asked on

Time/Date Query

Hi there, I am not sure if this is correct or not...

Set CheckCurrency=oConn.Execute("SELECT * FROM site_curr WHERE curr_update=<#"&Now()&"# AND curr_uptime=<#"&Time()+1&"#")

Open in new window


What I want to do is check if these values is more than 1 hour old from the values in the DB

eg if it is 10am, are the values prior to 9am (that same day)

Any help is appreciated
SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
what's your database? Access?
Avatar of Graeme McGilvray

ASKER

Hi Ryan, yes Access 2003

BigMonty, trying your code, got this error:
Expected ')'

/home.asp, line 112

Set CheckCurrency=oConn.Execute("SELECT * FROM site_curr WHERE curr_update=<#"&Now()&"# AND curr_uptime=<#DateAdd( "h", "Now()" 1 )#")

Open in new window

Points to the h in DateAdd
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Looks very promising

And from here, I would use this IF statement to execute if it is outside 60min old?

If Not CheckCurrency.EOF Then

Open in new window

?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Cheers for that, work great! (by itself)

In reference to one of our previous questions (aspJSON), when we add this query & If statement, would there be any reason why aspJSON now become an error?

It does not error when the If statement and query commented out or if aspJSON isnt within the If statement, but within it errors, cannot figure out why
Class aspJSON

Open in new window

Change the name of the page to:

http://dev.gptouring.com.au/currAPI.asp (same user and pw)
when we add this query & If statement, would there be any reason why aspJSON now become an error?
it shouldn't happened as both are not really "related" to each other. need to know the error message you encountered.

if it's a totally separate question, perhaps we can follow up in another new thread instead? so it's more likely to be traceable cheers.
Yes of course, I will start another thread for it

Cheers