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
 
Old August 4th, 2004, 09:18 AM
Friend of Wrox
 
Join Date: Aug 2003
Location: Halifax, Nova Scotia, Canada.
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
Default Select Article from today only

Hello All

I want to not only select an Article from todays date but I only want to display it from todays date. Okay that's no problem, I have that part working. But the problem is I don't always have any article for today. So I want to display only if there is an article and if no articles match today's date then nothing should be there. I hope that makes sense :)

-----------------------------------------------------------
"Don't follow someone who's not going anywhere" John Mason
__________________
-----------------------------------------------------------
\"Don\'t follow someone who\'s not going anywhere\" John Mason
 
Old August 4th, 2004, 09:31 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Not sure, if you are using SQL server or MSAccess. But let me post this considering SQL server.

Intiate connection object and recordset object. Sql string should be contructed something like
strSql = "Select columnlist,... from ArticleTable where Convert(varchar(10),ArticleDate,121) = convert(varchar(10),getdate(),121)"

rs.Open, strSql, ConnObj

If Not rs.EOF then
     your display code
Else
     display nothing or say something about that.
End If

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old August 4th, 2004, 09:39 AM
Friend of Wrox
 
Join Date: Aug 2003
Location: Halifax, Nova Scotia, Canada.
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Wow that's so simple, I was trying to say
IF RS.Date = Today's date then
display
else
end if

Something like that anyways, cool thanks for your help and quick reply.

Thanks

-----------------------------------------------------------
"Don't follow someone who's not going anywhere" John Mason
 
Old August 4th, 2004, 09:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Yes that way too works fine, but the recordset would have all the records populated and you will have to loop through it in your frontend till you get that matched to today's date, which is really not needed. This filters only for the current day's records and populates the recordset with just that or EOF if no match. So that way half your job is done at the backend and all you have to do is just display if any.

Cheers!

_________________________
- Vijay G
Strive for Perfection




Similar Threads
Thread Thread Starter Forum Replies Last Post
Error in BLL.Article.Article.cs drohm BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 August 14th, 2006 09:56 AM
2nd new article today: JavaScript and the DOM jminatel Javascript 0 March 23rd, 2006 03:58 PM
ASP Today downloads Carl Olsen Wrox Book Feedback 1 July 31st, 2003 11:00 AM
ASP Today downloads Carl Olsen All Other Wrox Books 0 July 31st, 2003 09:31 AM
C#Today \ The Eliminator qwert231 Forum and Wrox.com Feedback 1 July 21st, 2003 07:53 AM





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