Source Code for http://194.8.136.102/guestbook/guestbook.asp
COLOR LEGEND
| Server Side Script |
| Client Side Script |
| Hyperlink |
| Include |
| Frames |
| Comments |
| Object Code Link |
| Standard HTML and Text |
<%@ LANGUAGE="VBScript" %>
<HTML>
<HEAD>
<TITLE>Entries in the guest book</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TOPMARGIN=0 LEFTMARGIN=35>
<H1>Guestbook entries</H1>
<%
nPageSize = 5
If Not IsObject(Session("RS")) Then
Set Conn = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.RecordSet")
Conn.Open "softwing"
strSQLStmt = "select * from tGuestbook"
nPageTo = 1
RS.Open strSQLStmt, Conn
RS.PageSize = nPageSize
Set Session("RS") = RS
Else
' we are paging
strPageTo = Request("PageTo")
If strPageTo <> "" Then
nPageTo = CLng(strPageTo)
If nPageTo < 1 Then nPageTo = 1
Else
nPageTo = 1
End If
End If
If Not IsObject(Session("RS")) Then
Response.Write "Recordset not valid"
Response.End
End If
Set RS = Session("RS")
If RS.Supports(8192) Then
' bookmarks must be supported, like in SQL Server
RS.AbsolutePage = nPageTo
Else
RS.MoveFirst
' could be optimized (or rather should)
RS.Move(nPageTo - 1) * nPageSize
End If
%>
Current page number: <%=nPageTo%><P>
<TABLE CELLPADDING=3 CELLSPACING=2>
<TR><TH></TH><TH COLSPAN=2 bgcolor="#eeeeee">Rating</TH></TR>
<TR>
<TH ALIGN=LEFT bgcolor="#eeeeee">Guest</TH>
<TH ALIGN=LEFT bgcolor="#eeeeee">Information</TH>
<TH ALIGN=LEFT bgcolor="#eeeeee">Layout</TH>
<TH ALIGN=LEFT bgcolor="#eeeeee">Date</TH>
</TR>
<%
nRowCount = RS.PageSize
While Not RS.EOF And nRowCount > 0
Response.Write "<TR>"
%>
<TR>
<TD><A HREF="Entry.asp?Id=<%=RS("ID")%>"><%=RS("Name")%></A></TD>
<TD><%=RS("IMark")%></TD>
<TD><%=RS("GMark")%></TD>
<TD><%=RS("DateEntered")%></TD>
</TR>
<%
nRowCount = nRowCount - 1
RS.MoveNext
Wend
Response.Write "</TABLE><P><TABLE><TR>"
If nPageTo > 1 Then
%>
<TD><FORM METHOD=POST ACTION="<%=Request.ServerVariables("SCRIPT_NAME")%>">
<INPUT TYPE=HIDDEN NAME="PageTo" VALUE=<%=nPageTo-1%>>
<INPUT TYPE=SUBMIT VALUE="<<">
</FORM></TD>
<%
End If
If nRowCount = 0 And Not RS.EOF Then
%>
<TD><FORM METHOD=POST ACTION="<%=Request.ServerVariables("SCRIPT_NAME")%>">
<INPUT TYPE=HIDDEN NAME="PageTo" VALUE=<%=nPageTo+1%>>
<INPUT TYPE=SUBMIT VALUE=">>">
</FORM></TD>
<%
End If
Response.Write "</TABLE>"
%>
<P>
<A HREF="/main.asp">Back</A> to softwing.com main page<P>
</BODY>
</HTML>