qboard.asp Lists all the topics under a certain layout, and after clicking on the topic name, it goes to the appropriate topic list. This list is implemented by qtopic.asp, an ASP script. Qtopic.asp's code is virtually indistinguishable from qboard.asp in nature, but differs in its own details, and is not intended to be talked about any more.
After clicking on the article title in the article list, you will enter the article content browsing page article.asp:
<%
Articleid=request ("ArticleID")
Set conn = Server.CreateObject ("ADODB. Connection ")
Conn. Open "Driver={microsoft Access driver (*.mdb)};d bq=" & Server.MapPath ("Bbssystem.mdb")
Set cmd = Server.CreateObject ("Adodb.command")
Set cmd. ActiveConnection = conn
Cmd.commandtext = "Query article by ID"
ReDim param (0) ' statement
Param (0) = CLng (ArticleID) ' CInt cannot be ignored
Set rs = cmd. Execute (, param)
Author=rs ("Author id")
Title=rs ("title")
Data=rs ("date")
Rate=rs ("recommended degree")
Boardid=rs ("Kanban id")
Topicid=rs ("Subject ID")
Boardname=rs ("Kanban name")
Topicname=rs ("Subject name")
Content=rs ("content")
Content=replace (Content,vbcrlf, "</p>< p>")
Content= "< p>" & content & "</p>"
This is a place to note that the Content field contains the memo type of text, which can contain a carriage return. In the HTML display, you must change the carriage return (that is, the vbCrLf constant) to the HTML paragraph symbol. This will not disrupt the formatting of the original input when the paragraph and paragraph are connected. If you want to design better, you can use CSS to redefine < p> tags, set their test-indent properties, you can achieve the beginning of each paragraph of space.
' Add the number of clicks to a
Sql= "Update content table Set hits = click Times +1 Where id=" & ArticleID
Conn.execute SQL
Here is an SQL statement, not when the page is displayed, the corresponding table will be clicked on the number of times to add one, so that the number of articles to browse the statistics, and can be ranked in order. At the time of the execution of the statement, My Strange discovery: Originally in the SQL statement, the embedded variable name should be prefixed with the distinction, but in the ArticleID variable here I do not add single quotes, incredibly can also pass, and I used to write this will always cause errors, I don't know if it's because of the new version of ADO.
Set cmd=nothing
%>
< html>
< head>
< title>untitled document</title>
< meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
< body bgcolor= "#E9E9E4" >
< table width= "89%" border= "0" cellspacing= "0" cellpadding= "0" align= "center" >
< tr bgcolor= "#CCCCCC" >
< td> author:< font color= "#FF3366" >< a href= "qauthor.asp?author=<%=author%>" > <%=author%> & Lt /a></font> Published date:< font color= "#FF3333" ><%=data%></font>
Kanban:< font color= "#FF3333" >< a href= "qboard.asp?boardid=<%=boardid%>" > <%=boardname%></A ></font> Board recommended:< font color= "#FF3333" > #rate #</font></td>
</tr>
< tr bgcolor= "#CCCCCC" >
< td> title:< font color= "#FF3333" ><%=title%>
Theme:< a href= "qtopic.asp?topicid=<%=topicid%>" > <%=topicname%> </a> </font></td>
</tr>
< tr valign= "Top" >
< td>
< hr>
< font color= "#FF3366" > Article content: </font>< br>
< br>
< font color=blue><%response.write content%></font>
< br>
< br>
</td>
</tr>
< tr valign= "Top" >
< TD height= "a" >
< table width= "50%" border= "0" cellspacing= "0" cellpadding= "0" align= "right" bgcolor= "#CCCCCC" >
< tr>
< TD width= "0%" > </td>
< TD width= "65%" > About this topic < a href= "submit.asp?topicid=<%=topicid%>&boardid=<%=boardid%>" > Post comments </a></td>
This link allows users to express their views on the topic of this comment, which is what the next module is going to tell you, and click here.
</tr>
</table>
</td>
</tr>
</table>
</body>
<%
Set rs=nothing
Conn.close
Set conn=nothing
%>
To this end, the article shows that the section is completed. Let's take a look at how the article published is implemented.