|
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;
using System.Configuration;
using System.Text;
using System.Data.SqlClient;
public partial class RSS_RecentPackagesRSS : System.Web.UI.Page
{
public const string PackageReportURL = "http://sankhadev/RSSWebApp/PublisherDetails.aspx";
protected void Page_Load(object sender, EventArgs e)
{
//
// Set the content type
//
Response.ContentType = "text/xml";
RSSBuilder rsb = new RSSBuilder();
rsb.Title = "Publisher Details";
rsb.Link = PackageReportURL;
rsb.Description = "Use this RSS feed to keep track of All the Publishers of Various Regions";
rsb.Language = "en-us";
rsb.Copyright = "Microsoft 2006";
rsb.PublishingDate = DateTime.Now.ToString();
rsb.Subject = "Publisher Details";
rsb.TTL = "60";
DataSet ds;
string sqlQuery = "SELECT pub_name,city,state,country,pub_id FROM publishers";
System.Data.SqlClient.SqlConnection con = new SqlConnection();
con.ConnectionString = "server=localhost;persist security info=False;initial catalog=pubs;Trusted_Connection=false;user id=sa;password=sa";
con.Open();
ds = new DataSet();
SqlDataAdapter ada = new SqlDataAdapter(sqlQuery, con);
ada.Fill(ds);
foreach (DataRow dr in ds.Tables[0].Rows)
{
//
// Adding an item in the feed
//
RSSEntry entry = new RSSEntry();
entry.Title = "The Details of " + dr["pub_name"];
entry.Description = "Name: " + "<b>" + dr["pub_name"] + "</b>" + "<br> Publisher ID: " + "<b><font color='green'><i>" + dr["pub_id"] + "</i></font></b>" + "<br>" + "Location: " + "<b><font color='red'><i>" + dr["city"] + "," + dr["state"] + "," + dr["country"] + "</i></font></b>";
entry.CategoryForPublisherLocation = dr["country"].ToString();
entry.Link = PackageReportURL;
entry.Guid = entry.Description;
entry.Subject = "Name: " + dr["pub_name"] + " Publisher ID: " + dr["pub_id"];
rsb.AddEntry(entry);
}
Response.Write(rsb.GetXML());
//
// Finish up
//
Response.End();
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.