📄 gbook.asp
字号:
<td align="right" valign="middle" height="35" width="108"> <div align="center">
<input type="hidden" name="action_e" value="Add_New">
</div></td>
<td colspan="2" align="right" valign="middle" height="35" width="442">
<p align="left">
<input type="submit" name="Submit" value="立即提交"> <input type="reset" name="Submit2" value="重新填写">
</td>
</tr>
</form>
</table>
<br>
<% End Sub %>
<%
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
%>
<% Sub Main_Menu() %>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td colspan="2" height="10"></td></tr>
<tr>
<td width="554" height="35" valign="top"> <a href="gbook.asp?action=Admin_Login"><img border="0" src="images/gblogin.gif"></a> <a href="gbook.asp?action=Add_New"><img src="images/write.gif" border="0"></a> <a href="gbook.asp?action=View_Words"><img border="0" src="images/view.gif"></a>
<% If Session("Admin")="Login" Then %>
<a href="gbook.asp?action=Edit_web"><img border="0" src="images/setup.gif"></a> <a href="gbook.asp?action=EditPWD"><img border="0" src="images/editpass.gif"></a>
<% End If %>
<% If Session("Admin")="Login" Then %><a href="gbook.asp?action=Exit"><img border="0" src="images/quit.gif"></a>
<% End If %>
</td>
<td width="146" height="35" valign="middle">
<% if len(webtitle)>2 then %><font color="#FF0000" style="font-size:12px"><marquee onMouseOut=start(); onMouseOver=stop(); scrollamount=3 width="145" height="20">
<%=webtitle %> </marquee></font><% end if %>
</td>
</tr>
</table>
<% End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'查看留言
Sub View_Words()
'几个ASP语句说明(温故而知新)
'sql="select sum(字段名) as 别名 from 数据表 where 条件表达式" 使用 rs("别名") 得到值
'AVG(字段名) 得出一个表格栏平均值
'COUNT(*|字段名) 对数据行数的统计或对某一栏有值的数据行数统计
'MAX(字段名) 取得一个表格栏最大的值
'MIN(字段名) 取得一个表格栏最小的值
'SUM(字段名) 把数据栏的值相加
' OleDbDataReader dr = db1.getReader("select top "+n+" * from news where 类别="+strCID+" and (id not in (select top "+n*(page-1)+" id from news where 类别="+strCID+" order by ID DESC)) order by ID DESC");
'''''''''' 使用TOP分页方法
dim gbcount,n,x,y,j,k
n=25 '每页显示留言数
x=10 '每页显示的页数
set rs = conn.execute("select COUNT(*) as gbcount From words")
gbcount=rs("gbcount")
rs.close
if gbcount/n = int(gbcount/n) then '计算出分页数
y=int(gbcount/n)
else
y=int(gbcount/n)+1
end if
if (page2)*x > y then '计算出每页显示的页数
k=y
else
k=(page2)*x
end if
if page=1 then '判断页数,从而从第几条记录开始读数据
j=""
else
j="where id not in (select top "&n*(page-1)&" id from words Order By id Desc)"
end if
' 在第J条记录之后取得前N条记录
'set rs = conn.execute("select top "&n&" id,name,sex,head,web,email,title,words,date,reply,ip,come,view,qq From words "&j&" Order By id Desc") '打开记录的另一种方式,这种方式效率高,但没有打开记录集,一些功能受限
Set Rs = Server.CreateObject("ADODB.RecordSet")
Sql="select top "&n&" * From words "&j&" Order By id Desc"
Rs.Open Sql,Conn,1,1 '打开记录集
'传统的分页代码,*********开始
'TotalRecord=Rs.RecordCount '记录总数
'Rs.PageSize = 8 '每页显示的记录数
'PageSize = Rs.PageSize
'PageCount=Rs.PageCount ' 总页数
'if rs.bof and rs.eof then '错误处理
'CM="当前没有留言"
'else
'If page="" Then
'Rs.AbsolutePage = 1
'Else
'Rs.AbsolutePage = page
'End If
'end if
''*************传统的分页代码*****结
%>
<span>
<% if rs.bof and rs.eof then Response.Write "当前没有留言记录" %>
</span>
<%
dim lou,words,reply,email,qq,web,come
if Request.QueryString("page")<2 then
lou=gbcount
else
lou=gbcount-((Request.QueryString("page")-1)*n)
end if
do while not rs.eof
reply=""
words=""
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -