Results 1 to 4 of 4

Thread: Date Searching

  1. #1
    Join Date
    Jan 2002
    Location
    Nottingham - UK
    Posts
    113

    Unanswered: Date Searching

    My problem......

    I have a SQL db that I need to search a date range on - on my form I have to fields that a user will enter 2 dates.

    I need to search the db datetime field for date range specified on the form.

    Can anyone help ?

    Thanks

  2. #2
    Join Date
    Jan 2003
    Location
    Midwest
    Posts
    138
    lets assume the 2 fields are startDate and endDate

    Code:
    SELECT * FROM tableName WHERE dateField >= '" & Request.Form("startDate") & "' AND dateField <= '" & Request.Form("endDate") & "'
    
    or
    
    SELECT * FROM tableName WHERE dateField BETWEEN '" & Request.Form("startDate") & "' AND '" & Request.Form("endDate") & "'

  3. #3
    Join Date
    Jan 2002
    Location
    Nottingham - UK
    Posts
    113

    HELP !

    Hi Memnoch1207

    Understand you reply - thanks, one thing im not sure of is that on my actual form fields do I have to specify anything as I am getting http error 500.

    Can you help ?

    Thanks


    Originally posted by Memnoch1207
    lets assume the 2 fields are startDate and endDate

    Code:
    SELECT * FROM tableName WHERE dateField >= '" & Request.Form("startDate") & "' AND dateField <= '" & Request.Form("endDate") & "'
    
    or
    
    SELECT * FROM tableName WHERE dateField BETWEEN '" & Request.Form("startDate") & "' AND '" & Request.Form("endDate") & "'

  4. #4
    Join Date
    Jan 2002
    Location
    Nottingham - UK
    Posts
    113

    Hello

    I have attached the search and results page if you can take a look ?

    Any help appreicated !

    Donald


    Originally posted by Memnoch1207
    lets assume the 2 fields are startDate and endDate

    Code:
    SELECT * FROM tableName WHERE dateField >= '" & Request.Form("startDate") & "' AND dateField <= '" & Request.Form("endDate") & "'
    
    or
    
    SELECT * FROM tableName WHERE dateField BETWEEN '" & Request.Form("startDate") & "' AND '" & Request.Form("endDate") & "'
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •