<!--#include file="inc/conn.asp"-->
<% set rs=server.createobject("adodb.recordset")
sql="select * from news order by news_addtime desc"
rs.open sql,oConn,1,1
if rs.eof and rs.bof then
response.write"<p align='left'>还没有内容</p>"
else
dim maxpage, sql, rs, getnewsid, totleput, currentpage
if IsEmpty(request.QueryString) then
currentpage=1
else currentpage=request("page")
end if
rs.pagesize=20
filename="news.asp"
totalput=rs.recordcount
totalpage=rs.pagecount
maxperpage=rs.pagesize
if currentpage<=1 then
currentpage=1
end if
if currentpage>totalpage then
currentpage=totalpage
end if
if currentpage=1 then
showcontent
showpages
else
if (currentpage-1) * maxperpage< totalput then
rs.move (currentpage-1) *maxperpage
showcontent
showpages
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
sub showcontent
dim i, j, Anewstime, newstime
response.write"<table width='510' align='left' cellspacing='0'>"
i=1
do while not (rs.eof or err)
Anewstime=split(trim(rs("news_addtime"))," ")
newstime=Anewstime(0)
newstime=replace(newstime,"-","/")
response.write"<tr align='left'><td width='5%'height='22'align='left'><img src='/index/pw3-1.jpg' width='12' height='17'></td><td colspan='4' bgcolor='#B3F0D2'> <div align='left'><a href='news_show.asp?news_id="&rs("news_id")&"'>"&rs("news_title")&"</a>"
if DateDiff("y",rs("news_addtime"),now)<=3 then
response.write"<img src='images/new.gif' width='28' height='11'>"
end if
response.write newstime&"</div></td></tr>"
if i>=maxperpage then exit do
i=i + 1
rs.movenext
loop
end sub %>
<% sub showpages
dim n
n=totalpage
response.write"<form action="&filename&" method='post'>"
response.write"<tr><td height='27' colspan='2' align='right'><font color='#0000ff'>共"&totalpage&"</font>页/<font color='#0000ff'>"&totalput&"</font>条信息"
if currentpage<>1 then
response.write"<a href='"&filename&"'><font color='#0000ff'>首页</font></a>"
response.write"<a href='"&filename&"?page="&(currentpage-1)&"'>"
response.Write"<font color='#0000ff'>[上一页]</font></a>"
end if
if currentpage<>rs.pagecount then
response.write"<a href='"&filename&"?page="&(currentpage+1)&"'>[下一页]</a>"
response.write"尾页<a href='"&filename&"?page="&totalpage&"'></a>"
end if
response.write"第"¤tpage&"页/共"&totalpage&"页"
response.write"转到:<select name='page' size=1 class=smallselect >"
for i=1 to n
response.Write"<option value="&i
if currentpage=i then
response.write" selected"
end if
response.Write">"& i &"</option>"
next
response.Write"</select>"
response.Write"<input name='types' type='hidden' value='"&request("types")&"'>"
response.Write" <input class=buttonface type='submit' value='go' style='style1'>"
response.write"</td></tr></form></table>"
end sub
%>
我用ASPSTUDIO编译怎么老是提示类型不匹配啊???
Microsoft VBScript 运行时错误
错 误 码:0x800A000D错误代码:
错误描述:类型不匹配: '[string: "(null)"]'文件名称:z:\news.asp
所在行号:18
就是这一行啊:
if currentpage<=1 then