ASP/.NET Web Hosting
* 3 Months FREE *
CLICK HERE!
 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
124 active users
1796 visitors today
2571 pages today
how is this done?
ASP.NET Showcase
ASP.NET Graph and Chart Component with FREE developer version

ASP.NET Shopping Cart and E-commerce Control with FREE trial download

ASP.NET Web Hosting with free month and setup

$15 Domain Name Registration from .DNR.
As seen on these sites
Special thanks go to the sites that support me by publishing my articles.
See more

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

ASP.NET Blog
ASPRSS
ShawThing

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.asp" width="100%" height="150" marginheight=0 marginwidth=0>
   <a href="ShowDiary.asp">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

Selling products online - read how James does it now



New Proposal Kit Professional 5.1
Brand yourself as a top professional: create quotes and amazing proposals and get many legal documents free!

The latter saved me 3 times the purchase price on the first day I owned it!


See my source code
wherever you see this icon...

You can also download the entire site source code for FREE!