If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Show contents where date is greater than yesterday plus 10

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-27-04, 15:50
lewis94 lewis94 is offline
Registered User
 
Join Date: Apr 2004
Posts: 2
Show contents where date is greater than yesterday plus 10

I am trying to retrieve the event contents of an Access database, using ASP, by the date field where the date is today <= 10 days in advance. I have a field for the event date = DATE, from table FIXTURES, event = Event_id.

I normally use the following to produce my ASP pages with no trouble;

<% sqlString = "SELECT ......................................"
SET RS = oConn.Execute(sqlString)
WHILE NOT RS.EOF
%>

Thanks
Reply With Quote
  #2 (permalink)  
Old 04-27-04, 16:28
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
SELECT * FROM FIXTURES WHERE Event_id = " & event & " AND DATE <= DATEADD(d, 10, GETDATE())"

Or if the date you want to add 10 days to is a variable in ASP:

SELECT * FROM FIXTURES WHERE Event_id = " & event & " AND DATE <= DATEADD(d, 10, '" & date & "')"
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #3 (permalink)  
Old 04-27-04, 16:46
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
I should make a few notes.. in the title of your post you say "where date is greater than yesterday plus 10"

today >= (yesterday + 10)

But the text of the post reads "where the date is today <= 10 days in advance".

today <= (today + 10 days)

I gave you an example based upon the later... If you need an example of the former, it would be: DATE >= DATEADD(d, 9, GETDATE())

I should note that I didn't put a lower limit on that... so a more complete example might be:

SELECT * FROM FIXTURES WHERE Event_id = " & event & " AND DATE >= GETDATE() AND DATE <= DATEADD(d, 10, GETDATE())"

This would give you all rows who's "date" field is greater than, or equal to, today, but less than, or equal to, 10 days in advance. To go backwards in the calendar (to get say, yesterday's date), you would use a negative number: DATEADD(d, -1, GETDATE())
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #4 (permalink)  
Old 04-27-04, 17:01
lewis94 lewis94 is offline
Registered User
 
Join Date: Apr 2004
Posts: 2
I have tried your statements but just get the one error;

Microsoft JET Database Engine error '80040e14'

Undefined function 'GETDATE' in expression.

I am missing something completey or should i really just give up and go back to my PS2
Reply With Quote
  #5 (permalink)  
Old 04-27-04, 17:25
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
That would be due to Access. I assumed this was MS SQL Server. Substitute Now or Now() (I can't remember which) for GETDATE().
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On