ttt2的专栏

水的世界

用asp生成rss

<%
 Response.Clear
 Response.CharSet="gb2312"  '数据集
 Response.ContentType="text/xml"  '数据流格式定义
 Response.Write "<?xml version=""1.0"" encoding=""gb2312""?>"&vbNewLine
 
  sRssHead = "<rss version='2.0'>" & vbNewLine
  sRssHead = sRssHead & "<channel>" & vbNewLine
  sRssHead = sRssHead & "<title>xx网</title>" & vbNewLine
  sRssHead = sRssHead & "<description>xx新闻更新</description>" & vbNewLine
  sRssHead = sRssHead & "<link>http://www.xxcom/</link>" & vbNewLine
  sRssHead = sRssHead & "<language>zh-cn</language>" & vbNewLine
  sRssHead = sRssHead & "<docs>xx网新闻更新</docs>" & vbNewLine
  sRssHead = sRssHead & "<generator>Rss Generator By 养殖网</generator>" & vbNewLine

  sRssEnd = "</channel></rss>"
%>
<%
  response.write sRssHead
  %>
  <%set cn=server.createobject("adodb.connection")
  cn.open connstr
  set rs=server.createobject("adodb.recordset")
  rs.open "select top 20 title,c_filename,writefrom,date from wz_list where lanmuid=21 order by id desc",cn,1,1
  while not rs.eof
  %>
<%="<item><title>"&rs("title")&"</title><link>http://www.yangzhi.com/news/"&rs("c_filename")&"</link><author>"&rs("writefrom")&"</author><pubDate>"&rs("date")&"</pubDate></item>"%>
  <%rs.movenext
  wend
  rs.close
  set rs=nothing
  cn.close
  set cn=nothing
  %><%
  response.write sRssend
  %>

阅读更多
个人分类: asp
上一篇asp读取rss
下一篇gridview模板列绑定gridview
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭