Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-23-2006, 08:06 AM   PM User | #1
zami
New Coder

 
Join Date: Sep 2006
Location: Pakistan
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
zami is an unknown quantity at this point
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
zami is offline   Reply With Quote
Old 12-24-2006, 01:14 PM   PM User | #2
bostjank
Regular Coder

 
Join Date: Jul 2002
Location: The sunny side of the Alps
Posts: 230
Thanks: 0
Thanked 0 Times in 0 Posts
bostjank is an unknown quantity at this point
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..
bostjank is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:26 PM.


Advertisement
Log in to turn off these ads.