...

View Full Version : how to retrive data by entering two dates in asp form



zami
12-23-2006, 08:06 AM
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:cool:

bostjank
12-24-2006, 01:14 PM
You should use # delimiter instead of ' and format the date appropriately (month/day/year)


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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum