一个简单的bbs(五)
显示页面disp.asp:<% Set connection = Server.CreateObject("ADODB.Connection")
DBPath = Server.MapPath("bbs.mdb")
connection.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
set RS=Connection.Execute("SELECT * FROM bbs WHERE ID=topnum ORDER BY ID DESC")
Set conn = Server.CreateObject("ADODB.Connection")
DBPath = Server.MapPath("bbs.mdb")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
Do While not RS.EOF %>
<% =RS("id") %>
<a href="detail.asp?ID=<% =RS("id") %>"><% =RS("subject") %></a>
<FONT SIZE="4"><B><% =RS("authorname") %></B></FONT>
<%=RS("adddate") &" " %>
<% =RS("addtime") %>(<% =RS("visitnum") %>)<p>
<% Set RSNEXT=Conn.Execute("SELECT * FROM bbs WHERE topnum<>ID and Cstr(topnum)="&rs("id")&" ORDER BY ID ASC")
Do While Not RSNEXT.EOF %>
<% =RSNEXT(0) %>
<a href="detail.asp?ID=<% =RSNEXT(0) %>">Re<% =RSNEXT(6) %>:<% =RSNEXT(2) %></a>
<FONT SIZE="4"><B><% =RSNEXT(1) %></B></FONT> <% =RSNEXT(4) &" " %><% =RSNEXT(7) %>(<% =RSNEXT(5) %>)<P>
<% RSNEXT.MoveNext
Loop
RS.MoveNext
Loop
rsnext.Close
Conn.Close
RS.Close
Connection.Close %>
</body>
</html>
补充:asp教程,高级应用