|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
date query not working
Hello All.
I am trying to return data based on a variable set to yesterday's date. I saw another post that was similar but it was for access. Not sure if SQL server 2000 works the same. My code is below: thisDate = FormatDateTime(Now()-1,2) Set RS1 = Server.CreateObject("ADODB.Recordset") RS1.ActiveConnection = MM_RU_STRING RS1.Source = "SELECT * FROM ruwebuser.schedule where sch_date > thisDate ORDER BY sch_date ASC" RS1.CursorType = 0 RS1.CursorLocation = 2 RS1.LockType = 1 RS1.Open() I also tried these queries: RS1.Source = "SELECT * FROM ruwebuser.schedule where sch_date > 'thisDate' ORDER BY sch_date ASC" RS1.Source = "SELECT * FROM ruwebuser.schedule where sch_date > "& thisDate &" ORDER BY sch_date ASC" RS1.Source = "SELECT * FROM ruwebuser.schedule where sch_date > # " & thisDate & " # ORDER BY sch_date ASC" RS1.Source = "SELECT * FROM ruwebuser.schedule where sch_date > "& FormatDateTime(Now()-1,2) &" ORDER BY sch_date ASC" the date format I am comparing against is 3/24/2004. Thanks In advance!! Krs |
|
#2
|
||||
|
||||
|
I forgot to mention that it works when the query is this:
RS1.Source = "SELECT * FROM ruwebuser.schedule where sch_date > '3/25/2004' ORDER BY sch_date ASC" |
|
#3
|
||||
|
||||
|
Code:
RS1.Source = "SELECT * FROM ruwebuser.schedule WHERE sch_date > '" & thisDate & "' ORDER BY sch_date ASC" |
|
#4
|
||||
|
||||
|
Quote:
Damn, The quotes got me. It worked. Thanks! Krs |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > date query not working |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|