Select Query Syntax - Novice question

  • Thread starter Thread starter sean
  • Start date Start date
S

sean

Hi There,

I would like to know the correct syntax for the query below, I am trying to
verify a user session time (time_stamp) which is stoerd in the database is
with in 20 minutes of the current date / time on the server.

I know that I am close can someone help me out with a little syntax?

Thanks in advance

Sean


!--- query

SQL1 = "SELECT * FROM tblSessions WHERE sessionipaddr='" & ipAddr & "' AND
DateDiff("n",time_stamp,Now() <= 20)""
 
Hi There,

I would like to know the correct syntax for the query below, I am trying to
verify a user session time (time_stamp) which is stoerd in the database is
with in 20 minutes of the current date / time on the server.

I know that I am close can someone help me out with a little syntax?

Thanks in advance

Sean


!--- query

SQL1 = "SELECT * FROM tblSessions WHERE sessionipaddr='" & ipAddr & "' AND
DateDiff("n",time_stamp,Now() <= 20)""

Sean,
Try:
"SELECT * FROM tblSessions WHERE [sessionipaddr] ='" & [ipAddr] & "'
AND DateDiff('n',[time_stamp],Now()) <= 20" & ";"

You misplaced a closing parentheses, and you'll need to surround the
"n" in DateDiff() with single quotes in this case, as well as add the
; at the end.
 
Fred, thank you so much!!

Sean


Hi There,

I would like to know the correct syntax for the query below, I am trying to
verify a user session time (time_stamp) which is stoerd in the database is
with in 20 minutes of the current date / time on the server.

I know that I am close can someone help me out with a little syntax?

Thanks in advance

Sean


!--- query

SQL1 = "SELECT * FROM tblSessions WHERE sessionipaddr='" & ipAddr & "' AND
DateDiff("n",time_stamp,Now() <= 20)""

Sean,
Try:
"SELECT * FROM tblSessions WHERE [sessionipaddr] ='" & [ipAddr] & "'
AND DateDiff('n',[time_stamp],Now()) <= 20" & ";"

You misplaced a closing parentheses, and you'll need to surround the
"n" in DateDiff() with single quotes in this case, as well as add the
; at the end.
 
Back
Top