Solved

Show if date is greater than Now

Posted on 2004-04-27
5
483 Views
Last Modified: 2006-11-17
I am fairly new to ASP but have used this site and books to get a better understanding. However I want to show a range of dates for up and coming events but the date must be Today and onwards for 10 days. My date field are stored as Date_id, Event = Event_id and Location = Location_id. I use sql to call in the scripts. This may seem a stupidly basic question but I've tried so much I've given up.

Thanks
0
Comment
Question by:lewis94
  • 3
  • 2
5 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 10927093
Hi lewis94,

Select * From MyTable Where DateDiff(day,GetDate(),Date_ID) <=10

For MSSQL

Or

Select * From MyTable Where DateDiff(day,Now(),Date_ID) <=10

For Access

Tim Cottee
Brainbench MVP for Visual Basic
http://www.brainbench.com
0
 

Author Comment

by:lewis94
ID: 10927148
Thanks for the quick response. It makes sense but I just got so tired of trying that I somehow managed to get into a tizzy and gave up.

Thanks again

Lewis94
0
 

Author Comment

by:lewis94
ID: 10928695
I tried the script for the access database but keep getting an error. The SQL I use is as follows

<% sqlString = "Select * From fixtures Where DateDiff(date,now(),Date) <=10"
SET RS = oConn.Execute(sqlString)
WHILE NOT RS.EOF
%>

A colleague says it is because I use the RS method which is not suitable. Is this correct and if so how can I change it or is there a good book you could recommend?

Puzzled?????

Lewis94
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 10928752
lewis94,

With access it is:

DateDiff("d",now(),[Date])

It requires a slightly different syntax. My error as it was some ridiculous time in the morning for me when I posted that response.

Tim.
0
 

Author Comment

by:lewis94
ID: 10971084
Just in case any one else wanted to know the answer, after playing around ith the script I used the following;

SELECT * FROM FIXTURES WHERE [DATE] BETWEEN Date() AND Date()+10 ORDER BY [DATE] DESC

Thanks for all your help
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ASP/VB email question 4 61
If condition on Html with Asp 11 38
Adding 1 the value of input "text" every 3 seconds 5 32
window close link 7 32
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question