做一个新闻系统,想加上RSS功能,不知道怎么写程序啊?有这样的代码吗?? 做一个新闻系统,想加上RSS功能,不知道怎么写程序啊?有这样的代码吗?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 研究一下RSS的标准就可以了说白了就是一个固定了格式的XML文件而已 Public Function getrss(ByVal strsql As String) As String 'getRSS Dim strRSS As String Dim i As Int64 Dim K As Int64 OleDbConnection1.ConnectionString = strconnection OleDbDataAdapter1.SelectCommand.Connection = OleDbConnection1 OleDbDataAdapter1.SelectCommand.CommandText = strsql OleDbConnection1.Open() OleDbDataAdapter1.Fill(DataSet1) 'DataSet1.Reset() ' 清除所有的记录集 'datagrid1.DataSource = DataSet1.Tables.Item(dt) 'datagrid1.DataBind() strRSS = strRSS + "<?xml version=""1.0"" encoding=""gb2312""?>" strRSS = strRSS + "<rss version=""2.0""> " strRSS = strRSS + "<channel>" strRSS = strRSS + "<title>*********</title>" strRSS = strRSS + "<link>http://www.******/unet</link>" strRSS = strRSS + "<language>zh-cn</language> " strRSS = strRSS + "<description>BY UNET</description>" Dim R As DataRow For Each R In DataSet1.Tables(0).Rows strRSS = strRSS & "<item>" strRSS = strRSS & "<title>" & R(3) & "</title>" strRSS = strRSS & "<link>http://www.****/shownews.aspx?id=" & R(0) & "</link> " 'strRSS = strRSS & "<description>" & R(0) & "</description>" strRSS = strRSS & "<copyright>BY UNET</copyright>" strRSS = strRSS & "<pubDate>" & R(8) & "</pubDate>" 'strRSS = strRSS & "<comments>" & R(0) & "</comments>" strRSS = strRSS & "</item>" Next strRSS = strRSS + "</channel>" strRSS = strRSS + "</rss>" Return strRSS OleDbConnection1.Close() End Function RSS(Really Simple Syndication)是一种描述和同步网站内容的格式,是目前使用最广泛的XML应用。 具体的Google一下,资料很多 这个可能对你有帮助http://www.51aspx.com/CV/RssReader 如何做功能“在戴尔网站中 左边选择 购买电脑配置 右边则动态显示价格 ” 帮忙解析一句话 哪位有关于sql存储过程的电子书啊?谢谢 把repeater导入excel的办法? 新手请教一个程序问题.帮忙解答一下!感谢 简单正则表达式 服务器里所有站点都自动生成global.asax文件 vs2005 发布 网站 时 dll的版本总是0.0.0.0,怎么回事 水晶报表的统计显示的小问题 ASP.net应用 50求一个漂亮的WMP在线播放器模版 恢复数据库的问题
说白了就是一个固定了格式的XML文件而已
Dim strRSS As String
Dim i As Int64
Dim K As Int64
OleDbConnection1.ConnectionString = strconnection
OleDbDataAdapter1.SelectCommand.Connection = OleDbConnection1
OleDbDataAdapter1.SelectCommand.CommandText = strsql
OleDbConnection1.Open() OleDbDataAdapter1.Fill(DataSet1)
'DataSet1.Reset() ' 清除所有的记录集
'datagrid1.DataSource = DataSet1.Tables.Item(dt)
'datagrid1.DataBind()
strRSS = strRSS + "<?xml version=""1.0"" encoding=""gb2312""?>"
strRSS = strRSS + "<rss version=""2.0""> "
strRSS = strRSS + "<channel>"
strRSS = strRSS + "<title>*********</title>"
strRSS = strRSS + "<link>http://www.******/unet</link>"
strRSS = strRSS + "<language>zh-cn</language> "
strRSS = strRSS + "<description>BY UNET</description>"
Dim R As DataRow
For Each R In DataSet1.Tables(0).Rows
strRSS = strRSS & "<item>"
strRSS = strRSS & "<title>" & R(3) & "</title>"
strRSS = strRSS & "<link>http://www.****/shownews.aspx?id=" & R(0) & "</link> "
'strRSS = strRSS & "<description>" & R(0) & "</description>"
strRSS = strRSS & "<copyright>BY UNET</copyright>"
strRSS = strRSS & "<pubDate>" & R(8) & "</pubDate>"
'strRSS = strRSS & "<comments>" & R(0) & "</comments>"
strRSS = strRSS & "</item>" Next strRSS = strRSS + "</channel>"
strRSS = strRSS + "</rss>"
Return strRSS OleDbConnection1.Close() End Function
这个可能对你有帮助http://www.51aspx.com/CV/RssReader