|
<%
'If there are no rcords in the database display an error message
If rsGuestbook.EOF Then
'Tell the user there are no records to show
Response.Write " There are no records in the guestbook database" Response.Write " Please check back later" Response.End 'Display the guestbook Else 'Count the number of enties in the guestbook database intTotalNumGuestbookEntries = rsGuestbook.RecordCount 'Count the number of pages there are in the guestbook database calculated by the PageSize attribute set above intTotalNumGuestbookPages = rsGuestbook.PageCount 'Display the HTML number number the total number of pages and total number of records in the guestbook database %>
<% 'For....Next Loop to display records from the guestbook database For intRecordLoopCounter = 1 to intRecordsPerPage 'If there are no guestbook records left to display then exit loop If rsGuestbook.EOF Then Exit For 'Read in the values form the database strName = rsGuestbook("Name") strCountry = rsGuestbook("Country") strEmailAddress = rsGuestbook("EMail") dtmEntryDate = CDate(rsGuestbook("Date_stamp")) strHomepage = rsGuestbook("Homepage") strComments = rsGuestbook("Comments") 'If there is no homepage entry to display the display no URL given If strHomepage = "http://" then strHomepage = "no URL given" 'Else turn the URL stored in the strHomepage variable into a hyperlink Else strHomepage = "" & strHomepage & "" End If 'Write the HTML to the web browser to display the guestbook entries %>
<% 'Move to the next record in the database rsGuestbook.MoveNext 'Loop back round Next End If 'Display an HTML table with links to the other entries in the guestbook %>
|