#12004/6/29 21:58:34
<!--#include file="conn.asp"-->
<%
'=================================================
'过程名:Showxinweng
'作 用:显示新闻标题,要求最多显示5条新闻标题,显示的标题字数给于限制,用CALL Showxinweng(5,18)调用此过程
'参 数:ArticleNum ----最多显示多少篇新闻
' TitleLen ----标题最多字符数,一个汉字=两个英文字符
'=================================================
sub Showxinweng(ArticleNum,TitleLen)
dim sqlxinweng,rsxinweng
dim gotTopic()
if ArticleNum>0 and ArticleNum<=100 then
sqlxinweng="select top " & ArticleNum
else
sqlxinweng="select top 5 "
end if
sqlxinweng=sqlxinweng & " * from ztc order by id desc"
Set rsxinweng= Server.CreateObject("ADODB.Recordset")
rsxinweng.open sqlxinweng,db,1,1
if TitleLen<0 or TitleLen>255 then TitleLen=50
if rsxinweng.bof and rsxinweng.eof then
response.write "<li>暂时没有新闻</li>"
else
do while not rsxinweng.eof
response.Write "<li><a href= 'Look.asp?ID=" & rsxinweng("id") &" " & rsxinweng("title") & " ' target='_blank'> </a></li><br>"
rsxinweng.movenext
loop
end if
rsxinweng.close
set rsxinweng=nothing
end sub
%>
这段程序在调试时不显示错误,就是不显法数据库中的记录,但从在浏览器的“查看”——“源文件”,可以看到显示的正确的ID及标题,请问是哪儿出错了?