danielwriter
09-11-2008, 07:49 PM
I am trying to select all the events from a msSQL db within the next 7 days starting from today. The select statement I am using is this:
sql = "select * from tEvents WHERE eventDate BETWEEN DateAdd(d,7,GetDate()) AND GetDate() ORDER BY eventDate"
set rsThisWeek = conn.execute(sql)
it doesn't throw me an error, however it isn't finding anything in the db. I know that there event dates that meet that criteria in the db. Whats weird is that if I change the select statement to get the events from the 7 previous days it works correctly. For example:
sql = "select * from tEvents WHERE eventDate BETWEEN DateAdd(d,-7,GetDate()) AND GetDate() ORDER BY eventDate"
set rsThisWeek = conn.execute(sql)
Anybody know why one would work and the other one doesn't?
Thanks in advance!
sql = "select * from tEvents WHERE eventDate BETWEEN DateAdd(d,7,GetDate()) AND GetDate() ORDER BY eventDate"
set rsThisWeek = conn.execute(sql)
it doesn't throw me an error, however it isn't finding anything in the db. I know that there event dates that meet that criteria in the db. Whats weird is that if I change the select statement to get the events from the 7 previous days it works correctly. For example:
sql = "select * from tEvents WHERE eventDate BETWEEN DateAdd(d,-7,GetDate()) AND GetDate() ORDER BY eventDate"
set rsThisWeek = conn.execute(sql)
Anybody know why one would work and the other one doesn't?
Thanks in advance!