Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

No longer display record after a certain date has passed. ASP/SQL

Guest
Jul 23, 2009 Jul 23, 2009

How would I set a recordset to no longer display a record after a certain date has passed?

For example:
I have a list of classified adverts.


After a certain time period, say, 6 months, would it be possible to use some kind of SQL statement to no longer display the advert?

I'm using ASP - VBSCRIPT with an SQL server.


The the date field in the SQL database displays on the page like this 2009-07-23


Thanks
Gary

TOPICS
Server side applications
608
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 23, 2009 Jul 23, 2009

Include this in your SQL statement

WHERE  dateExpire_field > Now()

This of course isn't the exact code, I'm not an ASP guy, but this is the concept. This way as long as the date you set your record to expire is "further out" than the current date the record will be pulled. Once the expire date has passed it wont

--
Lawrence   *Adobe Community Expert*
www.Cartweaver.com
Complete Shopping Cart Application for
Dreamweaver, available in ASP, PHP and CF
www.twitter.com/LawrenceCramer

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 23, 2009 Jul 23, 2009
LATEST

Think I may have sussed it anyway (had to convert it slightly), used this statement:

WHERE Date >= cast(convert(varchar(8),getdate()-1,1) as datetime)

This now only displays the record whilst the date column in the table is either greater or equal to the current day

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines