会员
周边
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
着迷Linux
菲一打
生成自已的RSS文件
<
%@ Page Language
=
"
vb
"
AutoEventWireup
=
"
True
"
Debug
=
"
true
"
%
>
<
%@ Import
Namespace =
Namespace
=
"
System.Data
"
%
>
<
%@ Import
Namespace =
Namespace
=
"
System.Data.OleDb
"
%
>
<
%@ Import
Namespace =
Namespace
=
"
System
"
%
>
<
%@ Import
Namespace =
Namespace
=
"
System.Collections
"
%
>
<
%@ Import
Namespace =
Namespace
=
"
System.ComponentModel
"
%
>
<
%@ Import
Namespace =
Namespace
=
"
System.Data
"
%
>
<
%@ Import
Namespace =
Namespace
=
"
System.Drawing
"
%
>
<
%@ Import
Namespace =
Namespace
=
"
System.Web
"
%
>
<
%@ Import
Namespace =
Namespace
=
"
System.Web.SessionState
"
%
>
<
%@ Import
Namespace =
Namespace
=
"
System.Web.UI
"
%
>
<
%@ Import
Namespace =
Namespace
=
"
System.Web.UI.WebControls
"
%
>
<
%@ Import
Namespace =
Namespace
=
"
System.Web.UI.HtmlControls
"
%
>
<
script runat
=
"
server
"
>
Dim
strRSS
as
String
Dim
MyConnection
as
OleDbConnection
Sub Page_Load()
Sub
Page_Load(s
as
object
, e
as
eventargs)
MyConnection
=
New
OleDbConnection(
"
Provider=Microsoft.Jet.OLEDB.4.0; Data Source =
"
+
Server.MapPath(
"
.
"
)
+
"
/db/data2.mdb
"
)
Dim
MyCommand
As
OleDbDataAdapter
=
new
OleDbDataAdapter(
"
SELECT * FROM [news]
"
, MyConnection)
Dim
DS
As
DataSet
=
new
DataSet()
MyCommand.Fill(DS,
"
news
"
)
Response.ContentType
=
"
text/xml"
strRSS
+=
"
<rss version='2.0'>"
strRSS
+
=
"
<channel>"
strRSS
+
=
"
<title>菲一打</title>"
strRSS
+
=
"
<link>http://www.cnblogs.com/nhlinkin/</link>"
strRSS
+
=
"
<description>菲一打</description>"
Dim
i
As
Integer
=
0
For
i
=
0
To
ds.Tables(
0
).Rows.Count
-
1
strRSS
=
strRSS
+
"
<item>"
strRSS
=
strRSS
+
"
<title>
"
+
ds.Tables(
0
).Rows(i)(
"
title
"
)
+
"
</title>
"
strRSS
=
strRSS
+
"
<link>http://localhost/nhlinkin/testcodes/testcodes03/26_/ShowTitle.aspx?id=
"
+
ds.Tables(
0
).Rows(i)(
"
newsid
"
).ToString
+
"
</link>"
strRSS
=
strRSS
+
"
<description><![CDATA[
"
+
LEFT
(ds.Tables(
0
).Rows(i)(
"
contents
"
),
100
)
+
"
"
+
"
]]></description>"
strRSS
=
strRSS
+
"
<author>
"
+
ds.Tables(
0
).Rows(i)(
"
author
"
)
+
"
</author>"
strRSS
=
strRSS
+
"
<pubDate>
"
+
Convert.ToDateTime(ds.Tables(
0
).Rows(i)(
"
AddDateTime
"
).ToString()).ToString(
"
yyyy-MM-dd HH:mm
"
)
+
"
</pubDate>"
strRSS
=
strRSS
+
"
<comments>http://localhost/nhlinkin/testcodes/testcodes03/26_/ShowTitle.aspx?id=
"
+
ds.Tables(
0
).Rows(i)(
"
newsid
"
).ToString
+
"
</comments>"
strRSS
=
strRSS
+
"
</item>
"
Next
strRSS
+=
"
</channel>"
strRSS
+=
"
</rss>"
Response.
Write
(strRSS)
End Sub
</
script
>
发表于
2005-03-31 11:49
菲一打
阅读(
1075
) 评论(
0
)
收藏
举报
刷新页面
返回顶部
公告
导航
博客园
首页
新随笔
新文章
联系
订阅
管理