rss问题,实在不行了,求助!!!

deknight 2007-01-08 10:16:17
我在网上找的一段ASP的生成rss的代码,如下
==============
<!-- #include file="conn.asp" -->
<%
Dim sSQL, rs, sCrLf, sXmlClear, sRssHead, sRssEnd
sCrLf = chr(13) & chr(10) '回车+换行
sXmlClear = "<?xml version='1.0' encoding='gb2312'?>" & sCrLf
sRssHead = "<rss version='2.0'>" & sCrLf
sRssHead = sRssHead & "<channel>" & sCrLf
sRssHead = sRssHead & "<title> Why100000 </title>" & sCrLf
sRssHead = sRssHead & "<description> Why100000 </description>" & sCrLf
sRssHead = sRssHead & "<link>http://news.why100000.com/<;/link>" & sCrLf
sRssHead = sRssHead & "<language>zh-cn</language>" & sCrLf
sRssHead = sRssHead & "<docs>Why100000.COM News Center</docs>" & sCrLf
sRssHead = sRssHead & "<generator>Rss Generator By WWW.Why100000.COM</generator>" & sCrLf
sRssEnd = "</channel></rss>"
Response.CharSet="gb2312" '数据集
Response.ContentType="text/xml" '数据流格式定义
'输出:
Response.write sXmlClear
Response.write sRssHead
sSQL="select top 15 * from news order by id desc"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sSQL, s_Conn, 1,1
if not (rs.eof and rs.bof) then
do while not rs.eof
response.write "<item>" & sCrLf
response.write "<title>" & rs("title") & "</title>" & sCrLf
response.write "<link>" & "http:/127.0.0.1/news.asp?id="; & rs("id") & "</link>" & sCrLf
response.write "<author>" & rs("content") & "</author>" & sCrLf
response.write "<pubDate>" & rs("date") & "</pubDate>" & sCrLf
response.write "</item>" & sCrLf & sCrLf
rs.movenext
loop
end if
rs.close
set rs=nothing
Response.write sRssEnd
%>
======================

总是提示第27行出错,说语句未结束
第27行:response.write "<link>" & "http:/127.0.0.1/news.asp?id="; & rs("id") & "</link>" & sCrLf

我是死活找不出毛病来了,求各位帮忙!
...全文
178 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
deknight 2007-01-08
  • 打赏
  • 举报
回复
我晕。。。终于找到问题了
rs.Open sSQL, s_Conn, 1,1
conn.asp里是conn,不是s_conn
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
另外再问个问题:我输出的xml里,如何加上链接?
ishion 2007-01-08
  • 打赏
  • 举报
回复
'if not (rs.eof and rs.bof) then
do while not rs.eof
response.write "<item>" & sCrLf
response.write "<title>" & rs("title") & "</title>" & sCrLf
response.write "<link>" & "http:/127.0.0.1/news.asp?id=" & rs("id") & "</link>" & sCrLf
response.write "<author>" & rs("content") & "</author>" & sCrLf
response.write "<pubDate>" & rs("date") & "</pubDate>" & sCrLf
response.write "</item>" & sCrLf & sCrLf
rs.movenext
loop
'end if
chenguang79 2007-01-08
  • 打赏
  • 举报
回复
; 这个符号好相多于吧
deknight 2007-01-08
  • 打赏
  • 举报
回复
我看见;了,我去掉它dllhost立刻100,利马死循环
delphi_new 2007-01-08
  • 打赏
  • 举报
回复
response.write "<link>" & "http:/127.0.0.1/news.asp?id="& rs("id") & "</link>" & sCrLf
LZ多加了;
当然提示语句未结束

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧