The application of ASP technology in the forum. Four

Source: Internet
Author: User
Tags query
Article Display module

As I said before, a specific article is divided between the Kanban and the subject. Therefore, it is possible to get a list of articles under a specific topic by displaying the articles through both the Kanban list and the main list.

Now let's take a look at the display page of the Board list:

  

< html>

< head>

< title> Kanban List </title>

< meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">


<%

' Open the connection, display the Kanban list

Set conn = Server.CreateObject ("ADODB. Connection ")

Conn. Open "Driver={microsoft Access driver (*.mdb)};d bq=" & Server.MapPath ("Bbssystem.mdb")

sql = "SELECT * FROM Kanban list"

Set Rs=conn.execute (SQL)

%>

A simple SQL query that passes all Kanban information back to the recordset Rs. The following task is to display the record and remember the content, and set up a link to display the Kanban theme on the corresponding Kanban name.

  

< body bgcolor= "#FFFFFF" >

< h2 align= "center" > Kanban List
< table width= "60%" border= "0" cellspacing= "0" cellpadding= "0" align= "center" >

< tr bgcolor= "#FFFFCC" >

< TD height= "Width=" "25%" > Kanban name </td>

< TD height= "Width=" "21%" > Board main </td>

< TD height= "Width=" "23%" > Topics </td>

< TD height= "Width=" "31%" > Board main landing </td>

</tr>

  

Here's a section that shows the title of each column in the table, where I don't use a uniform function to display the RS record, because it gives more control over the appearance and style of the table, but it's more flexible to use, although it's a bit cumbersome.

  

<%

Todo

BOARDID=RS ("id")

Boardname=rs ("name")

Boardmanager=rs ("board Master")

  

Response.Write "< tr>< td>< a href=qboard.asp?boardid=" & Boardid & "&boardname=" & Boardname & ">" & Boardname & "</a></td>"

  

This line is the focus, and when clicked on the name of each board, you can link to the page that displays the Kanban theme. The code looks a bit cumbersome, I break it down for you and you'll understand. After clicking, the browser requests that the Qboard.asp page be invoked with a parameter boardid representing the ID number of the Kanban to display, and a question mark (?) between the request page and the parameter. Separated Boardid is the previously set variable, which contains the ID number of the corresponding kanban. This link is also accompanied by another parameter boardname, which is used to pass the Kanban name to the qboard.asp page. Use "&" between multiple parameters to separate. This parameter is not required and is passed in order to avoid querying the Kanban name again with Boardid in the qborad.asp. In general, the ability to use less database operations should be as small as possible, which can improve the performance of ASP pages.

Because the Response.Write statement uses a string as a parameter, the above string and variable use the "&" join character. The final ASP page explain the result should be like this:< td>< a href=qboard.asp?boardid=1&boardname= System board > System Board </a>< td>

  

Response.Write "< td>< a href=qauthor.asp?author=" & Boardmanager & ">" & Boardmanager & "< /a></td> "

Response.Write "< Td>" & RS ("Subject number") & "</TD>"

Response.Write "< td>< a href=managerlogin.asp?boardid=" & Boardid & "> board processing </a></td> </tr> "

  

In this table, in addition to the link to display the content of kanban topics, there is a bamboo query part and the Board Processing section, the owner query can be achieved through qauthor.asp, it is simply from the database to take out the author information, and display, here is not much to say. and the board processing is handled by the managerlogin.asp page. This belongs to the article review module, we'll talk about it later.

  

Rs.movenext

Loop until rs.eof

%>

  

Through a Do ... loop loop, all the information in the recordset is displayed. In this table, in addition to being able to

  

</table>

< div align= "center" >< br>

Click on the kanban name to get a list of topics, click on the board main name can be viewed board main information </div>

</body>


<%

Set rs=nothing

Conn.close

Set conn=nothing

%>

  

Let's take a look at the qbaord.asp page mentioned above:

  

<%

Boardid=request ("Boardid") ' takes out the Kanban ID number passed over from the previous page

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 = "topic list"

ReDim param (0) ' declares an array of arguments

Param (0) = CLng (boardid) ' CLng cannot be ignored

Set rs = cmd. Execute (, param)

%>

  

< html>

< head>

< title> Topics List </title>

< meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">


  

< body bgcolor= "#FFFFFF



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.