Author: Beach Boy
The previous article has been introduced to save the articles, and then you should talk about the display of the article. Here, you can see the simple ease of use of ASP, only through a file, you can display all the articles in the database. It opens the records specified in the database and specifies the content that is required for the display, primarily through the article number (ArticleID) returned from the connection and the column information (typeid).
The following is the detailed code and annotations for the article Display page (list.asp):
The Open database connection
<!--#include file= "conn.asp"-->
<%
The Define Variable
Dim sql
Dim rs
Dim typename
Dim typeid
Dim rstype,typesql
"Accept the returned column information and open the specified column recordset type
Typeid=request ("typeID")
Set Rstype=server.createobject ("Adodb.recordset")
Typesql= "SELECT * from type where typeid=" &cstr (typeid)
Rstype.open typesql,conn,1,1
"Invokes the specified column name and assigns its information to the TypeName
Typename=rstype ("type")
"Close the recordset
Rstype.close
%>
Pioneer </title> of <title>asp Dynamic Network
<link rel= "stylesheet" href= "Style.css" >
<body>
<div align= "center" ><center>
<table border= "1" width= "97%" cellspacing= "0" cellpadding= "0" bordercolorlight= "#000000"
bordercolordark= "#FFFFFF" >
<tr>
<TD width= "100%" bgcolor= "#D0D0D0" ><p align= "center" >
"Show Column information
Column:<%=typename&%>
<%
"Opens the specified recordset article and opens the specified article number with the returned article number ID, showing the article number, date of entry, number of views, article title, and article content.
Set Rs=server.createobject ("Adodb.recordset")
Sql= "SELECT * from Artidle where articleid=" &request ("id")
Rs.Open sql,conn,1,1
%>
----article number: <%=rs ("ArticleID")%>----Date Added: <%=rs ("date")%>----Views: <%=rs ("hits")%></td>