Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2006
    Location
    Pakistan
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool how to retrive data by entering two dates in asp form

    Hi,
    i want to retrive data as i have ms access database, and one date field, i want user |Enter First Date (From) and second date (TO) and then data will show in between that date. please help me
    thanks in advance

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    The sunny side of the Alps
    Posts
    230
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You should use # delimiter instead of ' and format the date appropriately (month/day/year)
    Code:
    myDate1 = Request.Form("...")
    dbDate1 = Month(myDate) & "/" & Day(myDate) & "/" & Year(myDate)
    myDate2 = Request.Form("...")
    dbDate2 = ...
    
    SELECT * 
       FROM table 
       WHERE DateField >= #" & dbDate1 & "# And Date <= #" & dbDate2 & "#"
    
    or
    
    SELECT * 
       FROM table 
       WHERE DateField Between #" & dbDate1 & "# And #" & dbDate2 & "#"
    Hope this helps,
    Bostjan
    Last edited by bostjank; 12-26-2006 at 01:00 PM.


  •  

    Posting Permissions

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