%
Option Explicit
Dim ConnectString,sql,conn,rsEntries,count
ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("guestbook.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnectString
sql = "SELECT * FROM guestbook ORDER BY datetime DESC"
Set rsEntries = Server.CreateObject("ADODB.Recordset")
rsEntries.Open sql, conn, 3, 3
%>
HKDAVC - chat
<% if rsEntries.EOF and rsEntries.BOF then
response.write "仍 未 有 意 見 發 表."
else
%>
<%
rsEntries.Movefirst
'If viewing a previous set of messages, move to the right position
if Request.QueryString("recordnum") <> "" then
rsEntries.Move(Request.QueryString("recordnum"))
end if
for count = 1 to 15%>
| "><%=rsEntries("by")%>
並 有 以 下 的 意 見 : |
<%=rsEntries("message")%> |
<%=rsEntries("datetime")%>
|
<%rsEntries.Movenext
'Quit loop if no more messages left
if rsEntries.EOF then
exit for
end if
next %>
<%
'If there's still some more messages after displaying the first 20, display a link to the next page, using the .AbsolutePosition property as a placeholder (an ID field in the database is not reliable enough if manual DB deletions occur)
'We use .AbsolutePostion - 1 because we've already done a .Movenext onto the record we want to display first on the next page
if not rsEntries.EOF then%>
閱 讀 以 前 的 意 見
<%end if%>
: : 講 東 講 Site : :
<%end if%>
<%
rsEntries.close
set rsEntries = nothing
conn.close
set conn = nothing
%>