用排序串字段实现树状结构(例程——显示贴子内容)

程序:disprec.asp
功能:显示贴子具体内容

 1   
 2keyid=request("keyid")   
 3rootid=request("rootid")   
 4pageno=request("pageno")   
 5if rootid=0 then rootid=keyid   
 6set guestconn=Server.CreateObject("ADODB.connection")   
 7guestconn.Open lybstr   
 8set guestrs=server.createobject("ADODB.recordset")   
 9sqlstr="SELECT * FROM guestbook where lybid="&rootid&" or rootid="&rootid   
10sqlstr=sqlstr&" order by orderstr,lybid desc"   
11guestrs.open sqlstr,guestconn,1,1   
 1<html>
 2<head><title>软件使用留言薄</title>
 3<style type="text/css">   
 4<!--   
 5a { text-decoration: none}   
 6body {line-height:18px;font-size:9pt;font-family:宋体}   
 7a:hover {color:#FF0000;text-decoration:none}   
 8td {font-family: 宋体; font-size: 9pt;background-color:ECF7FF}   
 9.td1 {font-family: 宋体; font-size: 9pt;background-color:A2C8F2}   
10.td2 {font-family: 宋体; font-size: 9pt;background-color:E9EDE0}   
11.small1 {font-family: 宋体; font-size: 9pt;background-color:ffffff;line-height:9pt}   
12\-->   
13</style>
14</head>
15<body background="topbg.gif" topmargin="16">
16<form action="index.asp" method="POST" name="index">
17<table align="center" width="100%">
18<tr>
19<td align="center" height="35" style="font-size:16px;background-color:ffffff;color:red" valign="top">软件使用   
20留言薄</td>
21<td align="center" colspan="2" style="background-color:ffffff" valign="bottom">相关留言共<font style="font-   
22size:16px;color:red">```
23 =guestrs.recordcount 
24```</font>条</td>
25<td align="center" style="background-color:ffffff" valign="bottom"><a href="index.asp?pageno=```
26 =pageno 
27```">   
28留言列表</a></td>
29<td align="center" style="background-color:ffffff" valign="bottom"><a href="revert.asp?type=post">发贴子   
30</a></td>
31</tr>
32<tr style="color:red">
33<td align="center" class="td1" width="70%">留言标题</td>
34<td align="center" class="td1" nowrap="" width="70"><img src="edit.gif"/>作 者</td>
35<td align="center" class="td1" nowrap="" width="100">发表时间</td>
36<td align="center" class="td1" nowrap="" width="60">贴子字数</td>
37<td align="center" class="td1" nowrap="" width="60">贴子序号</td>
38</tr>   

do while not guestrs.eof

 1<tr>
 2<td>```
 3 if guestrs("rootid")&amp;lt;&amp;gt;0 then response.write(replace(space(len(guestrs("orderstr")))," "," ")) %   
 4&amp;gt;&amp;lt;% if guestrs("lybid")+1=keyid+1 then   
 5if guestrs("rootid")=0 then   
 6rootid=guestrs("lybid")   
 7else   
 8rootid=guestrs("rootid")   
 9end if   
10lybid=guestrs("lybid")   
11guestitle=guestrs("guestitle")   
12guestname=guestrs("guestname")   
13guestemail=guestrs("guestemail")   
14guestcomm=guestrs("guestcomm")   
15putdate=guestrs("putdate")   
16puttime=guestrs("puttime")   
17emailflag=guestrs("emailflag")   

=guestrs("guestitle")

 1 else 
 2```&lt;a href='disprec.asp?keyid=```
 3 =guestrs("lybid") 
 4```&amp;amp;rootid=```
 5   
 6=guestrs("rootid") 
 7```&amp;amp;pageno=```
 8 =pageno 
 9```'&gt;```
10 =guestrs("guestitle") 
11```&lt;/a&gt;```
12 end if 
13```&lt;/td&gt;
14&lt;td align="right" nowrap=""&gt;```
15 =guestrs("guestname") 
16``` &lt;/td&gt;
17&lt;td align="center" nowrap=""&gt;```
18 =guestrs("putdate")&amp;" "&amp;guestrs("puttime") 
19```&lt;/td&gt;
20&lt;td align="right" nowrap=""&gt;```
21 =len(guestrs("guestcomm")) 
22``` &lt;/td&gt;
23&lt;td align="right" nowrap=""&gt;```
24 =guestrs("lybid") 
25``` &lt;/td&gt;
26&lt;/tr&gt;   
27```
28   
29guestrs.movenext   
30loop   
31guestrs.close   
32set guestrs=nothing   
33guestconn.close   
34set guestconn=nothing   
35
36```   
37&lt;tr&gt;&lt;td colspan="5" height="20" style="background-color:ffffff"&gt;&lt;/td&gt;&lt;/tr&gt;
38&lt;tr&gt;
39&lt;td align="center" style="color:red"&gt;```
40 =guestitle 
41```&lt;/td&gt;
42&lt;td align="right" width="70"&gt;```
43 =guestname 
44``` &lt;/td&gt;
45&lt;td width="100"&gt;```
46 =putdate&amp;" "&amp;puttime 
47```&lt;/td&gt;
48&lt;td align="right" width="60"&gt;```
49 =len(guestcomm) 
50``` &lt;/td&gt;
51&lt;td align="right" width="60"&gt;```
52 =lybid 
53``` &lt;/td&gt;
54&lt;/tr&gt;
55&lt;tr&gt;&lt;td colspan="5" height="50" style="background-color:f3F7FF" valign="top"&gt;```
56 =guestcomm 
57```&lt;p align="right"&gt;&lt;a href="delrec.asp?type=revert&amp;amp;keyid=```
58 =keyid 
59```&amp;amp;pageno=```
60 =pageno 
61```"&gt;删除留言&lt;/a&gt; &lt;a href="revert.asp?   
62type=revert&amp;amp;keyid=```
63 =lybid 
64```&amp;amp;pageno=```
65 =pageno 
66```"&gt;回复作者&lt;/a&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;
67&lt;/table&gt;
68&lt;/form&gt;
69&lt;/body&gt;
70&lt;/html&gt;
71```
Published At
Categories with Web编程
Tagged with
comments powered by Disqus