Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
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
Reply With Quote
  #3 (permalink)  
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
Reply With Quote
  #4 (permalink)  
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
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 01:16 PM.


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