Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 28th, 2003, 02:05 PM
Authorized User
 
Join Date: Jun 2003
Location: Frisco, TX, USA.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Selecting Data Based on Todays Date

I have a table of Bible Devotions with a field name Day with a date in that Field.

How do I select the record with the date that the person visits my site? Like if you visit today it would get the data based on today's date and if you visit tomorrow it would get data based on tomorrow's date.
?
Select Date, Verse From Devotion where Date = Today

Jeff Henderson
President-Worship Loud
http://www.worshiploud.com
__________________
Jeff Henderson
President-Worship Loud
http://www.worshiploud.com
  #2 (permalink)  
Old June 29th, 2003, 01:49 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Wien, Wien, Austria.
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

MSAccess: SELECT Date, Verse FROM Devotion WHERE Date=Date()
SQL Server: SELECT Date, Verse FROM Devotion WHERE Date=CONVERT(CHAR(10), GETDATE(),appropriate_style_value)

...but the Soon is eclipsed by the Moon
  #3 (permalink)  
Old June 29th, 2003, 07:55 PM
Authorized User
 
Join Date: Jun 2003
Location: Frisco, TX, USA.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Thanks for the input.

I figured out that the total number of records in my
table was 365. That is how many days there are in a year.
The date and verse were already in order by day of the year
so I used the day of the year to do the query.

var1 = Now()
sSQL = "SELECT * FROM Bands, Devotion Where Devotion.ID=" & DatePart("y", var1)

This way I could also get info from another table in my
DB as well as info specific for the day of the year.
Now I can just put info in the table and use one table
to pull all of my daily content.

Thanks for the tip.:)

Jeff Henderson
President-Worship Loud
http://www.worshiploud.com


Similar Threads
Thread Thread Starter Forum Replies Last Post
selecting date and previous dates harpua MySQL 0 April 5th, 2007 08:25 PM
Todays date and date of 3 days later Singh591 Visual Basic 2005 Basics 1 December 21st, 2006 06:06 PM
XPath - Selecting nodes based on attribute values billy_bob_the_3rd XML 4 December 1st, 2004 06:12 PM
Date based query when date is nvarchar MichaelTJ SQL Language 4 January 12th, 2004 09:57 PM
Default Value = Todays Date cej2583 SQL Server 2000 2 July 28th, 2003 10:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.