| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi everyone
I'm trying to find any examples or instruction on how to code some ASP that enables someone to search an Access db with a date field (mm/dd/yyyy) so many days back (to be specific, the user could select 7 days, 14 days, or 30 days from a pulldown menu) from the current date. If anyone could help me out it would be greatly appreciated. Thanks in advance! ![]() |
|
#2
|
|||
|
|||
|
You should insert a column indicating the last update or insertion datetime. Then you can narrow the search according to that criteria.
|
|
#3
|
||||
|
||||
|
One way to hand this might be to create a stored procedure on your SQL server:
CREATE PROCEDURE GetData As (@DaysBack Int) --Note @DaysBack would be the number of days selected by the user. SELECT * FROM sometable WHERE sometable.date >= GETDATE() -@DaysBack Then in your code you might do this: CN.Execute "GetData " & cmbDaysBack & "" In the above example, CN represents a SQL connection and cmbDaysBack represents the name of your drop down box. You will need to set the combo box so that the value of the combo box is equal to the number of days selected. Of course you could also use a textbox, and let the user decide how many days they want. ![]() |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > seraching previous days |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|