ASP + SQL2000 Date Processing

Source: Internet
Author: User

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.