The date problem occurs again when the date function is called today:
The form submission parameters are as follows:
<Input name = "searchordertime" type = "text" id = "searchordertime" maxlength = "12" value = "<% = SESSION (" searchordertime ") %>"/>
The code for receiving parameters in ASP is as follows:
Searchordertime = trim (Request ("searchordertime "))
The correct query time statement in SQL2000 is as follows:
Where datediff (D, ordertime, getdate () = 0 "is a reference
Syntax reference
Where datediff (D, ordertime, '"& cdate (searchordertime) &"') = 0"
Other statements include:
Where datediff (D, ordertime, # "& cdate (searchordertime) &" #) = 0"
Where datediff (D, ordertime, # "& searchordertime &" #) = 0"
Where datediff (D, ordertime, # "& formatedatetime (searchordertime, vb1_date) &" #) = 0"
Where datediff (D, ordertime, # "& formatedatetime (searchordertime, vblongtime) &" #) = 0"
Where datediff (D, ordertime, "& formatedatetime (searchordertime, vb1_date) &") = 0"
Where datediff (D, ordertime, "& searchordertime, vb1_date &") = 0"
All of them are incorrect. querying SQL datediff on the network is also not able to find the appropriate results for half a day.
Depressed. I thought of replacing it with single quotes when I was on a whim. # It was a success.