<%@ Page Language="vb" AutoEventWireup="True" Debug="true"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System"%>
<%@ Import Namespace="System.Collections"%>
<%@ Import Namespace="System.ComponentModel"%>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Drawing"%>
<%@ Import Namespace="System.Web"%>
<%@ Import Namespace="System.Web.SessionState"%>
<%@ Import Namespace="System.Web.UI"%>
<%@ Import Namespace="System.Web.UI.WebControls"%>
<%@ Import Namespace="System.Web.UI.HtmlControls"%>

<script runat="server">
Dim strRSS as String
Dim MyConnection as OleDbConnection

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>