CoverYourASP --> The Diary

Free membership

Join in the fun! Sign in
Member Services

Site navigation
Download the entire site!
Search my articles
Free Magazines
Browse the directory

Send me feedback
Buy my boxer shorts

Recommend this page
Printer-friendly page

Resources I recommend
Link to my site
Advertising slashed!
About your privacy
Legal stuff
Site statistics
97 active users
8 visitors today
12 pages today
how is this done?
Tools I use

CoverYourASP
Copyright © 1999-2016 James Shaw.
All rights reserved.

ASP.NET Blog
RSS submissions
E-commerce

Now open source with SourceForge!

For some time now I've wanted a better way to share the questions that I get emailed each day. My answer was to create a "diary", stored in the database, that allows me to post any amount of chit-chat, bug fix notifications and tips.

It was extremely easy to implement. First I created a new Diary table, which I add/edit/delete using my database admin pages.

I couldn't just display the list on the front page though, because some days may have very long entries in them, so I decided to use an <IFRAME;> tag instead. This gives a scrolling frame that you can effectively display a large amount of text in a small space.

<iframe src="/ShowDiary.html" width="100%" height="150" marginheight=0 marginwidth=0>
   <a href="/ShowDiary.html">Visit the Diary</a>
</iframe>

Anyone who uses a browser that doesn't support <IFRAME>'s will see a link instead, and they can always turn the diary off in the membership personalization page.

To put content into the <IFRAME> you need a new page. I created ShowDiary.asp, which just gets the data from the database, sorted by date, and displays them all. Note that this doesn't use the normal Header () and Footer () functions since this won't normally be used as a standalone page.

The code basically does what is shown below. For the full source code click the "Get the Source" icon below.

DBInitConnection  ( );

DBGetRecords ( 'SELECT DiaryDate,Entry FROM Diary ORDER BY DiaryDate DESC' );

while ( !oRecordSet.EOF )
{
   var sDate = '' + oRecordSet ( 0 );
   var sEntry = '' + oRecordSet ( 1 );

   // display data

   oRecordSet.MoveNext();
}

DBReleaseConnection  ( );

Note that the DB.. functions are utility functions included in utils/database.asp - a file available in the download.

Featured sponsor
My favorite resources

CoverYourASP Mugs, T-shirts, caps - even Boxer shorts...
I don't make a penny from these, but they're a lot of fun! Don't you need a new mouse mat?


I share my content

Supporting ASPRSS

Do you need a quick and easy way to link to my articles? All the information you need is published with ASPRSS...