这样可以出来
就是想把2换成变量cstr(newstype)不知道怎么办
我解决了,现在可以显示所有信息了
但是页面好像不能分页了,这个页面
<!--#include file="config.asp"-->
<!--#include file="top.htm"-->
<style type="text/css">
<!--
@import url("link.css");
@import url("text1.css");
-->
</style>
<%
const MaxPerPage=8
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim sql
dim rs
dim rstype
dim typesql
dim typeid,typename1
if not isEmpty(request("typeid")) then
typeid=request("typeid")
else
typeid=1
end if
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
%>
<%
newstype=request("typeid")
sql="select * from article where typeid="+cstr(newstype)+" order by dateandtime desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
%>
<TABLE cellSpacing=0 borderColorDark=#ffffff cellPadding=0 width=777 borderColorLight=#ff8000 border=1 align=center>
<TBODY>
<TR>
<TD width="100%">
<TABLE cellSpacing=0 cellPadding=0 width=777 border=0>
<TBODY>
<TR>
<TD vAlign=top width=161 bgColor=#fedec0>
<TABLE cellSpacing=0 cellPadding=0 width=161 border=0>
<TBODY>
<TR>
<TD width="100%" bgColor=#fe8d3e height=25>
<P align=center>
<SCRIPT src="images/time.js"></SCRIPT>
</P></TD></TR>
<TR>
<TD vAlign=top width="100%">
</TD></TR></TBODY></TABLE></TD>
<TD vAlign=top width=1 bgColor=#ff8000></TD>
<TD background=images/zwccc_le12.gif height=375 vAlign=top>
<br>
<TABLE cellSpacing=0 cellPadding=0 width=587 align=center border=0>
<TBODY>
<TR>
<TD><IMG height=27 src="images/0<%=rs("typeid")%>.gif"
width=450></TD></TR></TBODY></TABLE><BR>
<%
if rs.eof and rs.bof then
response.write "<p align='center'> 还 没 有 任 何 新 闻</p>"
else
totalPut=rs.recordcount
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
else
currentPage=1
showContent
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
sub showContent
dim i
i=0
%>
<TABLE cellSpacing=0 cellPadding=0 width=500 align=center border=0>
<TBODY>
<TR>
<TD width=500 height=28>
<script language="javascript" src="lnews1.asp?typeid=<%=cstr(newstype)%>"></script> </TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=500 align=center border=0>
<TBODY>
<TR>
<TD width=500 background=images/dian1.gif
height=5></TD></TR></TBODY></TABLE>
<%
end sub
%>
<center>
<%
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
if CurrentPage<2 then
response.write "<fontdisabled bgcolor=#93BEE2>首页 上一页</font> "
else
response.write "<a href="&filename&"?typename="&(request("typename"))&"&page=1&typeid="&typeid&" class=line>首页</a> "
response.write "<a href="&filename&"?typename="&(request("typename"))&"&page="&CurrentPage-1&"&typeid="&typeid&" class=line>上一页</a> "
end if
if n-currentpage<1 then
response.write "<font bgcolor=#93BEE2>下一页 尾页</font>"
else
response.write "<a href="&filename&"?typename="&(request("typename"))&"&page="&(CurrentPage+1)&"&typeid="&typeid&" class=line>"
response.write "下一页</a> <a href="&filename&"?typename="&(request("typename"))&"&page="&n&"&typeid="&typeid&" class=line>尾页</a>"
end if
response.write "<font bgcolor=#93BEE2> 共</font><strong><font bgcolor=#93BEE2>"&n&"</strong>页</font> "
response.write "<font bgcolor=#93BEE2> 共<b>"&totalnumber&"</b>条信息<b>"
end function
%><% showpage totalput,MaxPerPage,"list.asp"%>
</center>
</TD></TR></TBODY></TABLE>
</td></td>
</table>
<!---->
</BODY></HTML><!--#include file="bottom.htm"-->