<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:series="http://unfoldingneurons.com/"
		>
<channel>
	<title>Comments on: Create Dynamic RSS Feed from MS SQL Server using ASP.NET, Part II: C#</title>
	<atom:link href="http://www.linglom.com/2008/09/01/create-dynamic-rss-feed-from-ms-sql-server-using-aspnet-part-ii-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.linglom.com/2008/09/01/create-dynamic-rss-feed-from-ms-sql-server-using-aspnet-part-ii-c/</link>
	<description>Just another IT weblog</description>
	<lastBuildDate>Fri, 30 Jul 2010 22:18:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: linglom</title>
		<link>http://www.linglom.com/2008/09/01/create-dynamic-rss-feed-from-ms-sql-server-using-aspnet-part-ii-c/comment-page-1/#comment-4994</link>
		<dc:creator>linglom</dc:creator>
		<pubDate>Wed, 30 Dec 2009 01:37:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.linglom.com/?p=182#comment-4994</guid>
		<description>Hi, Amy
If you want the output to a xml file instead of on screen, you simply modify XmlTextWriter object on line 31. 

From
&lt;pre lang=&#039;csharp&#039;&gt;XmlTextWriter xml = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);
&lt;/pre&gt;
To
&lt;pre lang=&#039;csharp&#039;&gt;
XmlTextWriter xmlWriter = new XmlTextWriter(xmlFilePath, Encoding.UTF8);
&lt;/pre&gt;
where xmlFilePath is the file destination.</description>
		<content:encoded><![CDATA[<p>Hi, Amy<br />
If you want the output to a xml file instead of on screen, you simply modify XmlTextWriter object on line 31. </p>
<p>From</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">XmlTextWriter xml <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> XmlTextWriter<span style="color: #000000;">&#40;</span>Response.<span style="color: #0000FF;">OutputStream</span>, Encoding.<span style="color: #0000FF;">UTF8</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>To</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">XmlTextWriter xmlWriter <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> XmlTextWriter<span style="color: #000000;">&#40;</span>xmlFilePath, Encoding.<span style="color: #0000FF;">UTF8</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>where xmlFilePath is the file destination.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amy</title>
		<link>http://www.linglom.com/2008/09/01/create-dynamic-rss-feed-from-ms-sql-server-using-aspnet-part-ii-c/comment-page-1/#comment-4989</link>
		<dc:creator>Amy</dc:creator>
		<pubDate>Fri, 25 Dec 2009 01:01:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.linglom.com/?p=182#comment-4989</guid>
		<description>Thank you for this!! 

My only question is how can I alter it so that it writes to a file like myrss.xml?</description>
		<content:encoded><![CDATA[<p>Thank you for this!! </p>
<p>My only question is how can I alter it so that it writes to a file like myrss.xml?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: linglom</title>
		<link>http://www.linglom.com/2008/09/01/create-dynamic-rss-feed-from-ms-sql-server-using-aspnet-part-ii-c/comment-page-1/#comment-4657</link>
		<dc:creator>linglom</dc:creator>
		<pubDate>Mon, 31 Aug 2009 13:22:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.linglom.com/?p=182#comment-4657</guid>
		<description>Yes, you can do that. First, you modify your store procedure to get an additional column (the ID column) that you want. Then, modify the code on step 8 from
xml.WriteElementString(&quot;link&quot;, reader[3].ToString());
to 
xml.WriteElementString(&quot;link&quot;, reader[3].ToString() + &quot;?id=&quot; + reader[5].ToString());
(Assume that the column ID&#039;s index is 5)</description>
		<content:encoded><![CDATA[<p>Yes, you can do that. First, you modify your store procedure to get an additional column (the ID column) that you want. Then, modify the code on step 8 from<br />
xml.WriteElementString(&#8220;link&#8221;, reader[3].ToString());<br />
to<br />
xml.WriteElementString(&#8220;link&#8221;, reader[3].ToString() + &#8220;?id=&#8221; + reader[5].ToString());<br />
(Assume that the column ID&#8217;s index is 5)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Max Allen</title>
		<link>http://www.linglom.com/2008/09/01/create-dynamic-rss-feed-from-ms-sql-server-using-aspnet-part-ii-c/comment-page-1/#comment-4655</link>
		<dc:creator>Max Allen</dc:creator>
		<pubDate>Mon, 31 Aug 2009 08:02:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.linglom.com/?p=182#comment-4655</guid>
		<description>Hi linglom, sorry you must have miss understood. i need the value to come from the database as well so, if i had the link and the id in the database is there a way that i could pull them both together  so i get the web address http://localhost/CS09/getimage.asp?id= and then the ID, 10
which will make http://localhost/CS09/getimage.asp?id=10</description>
		<content:encoded><![CDATA[<p>Hi linglom, sorry you must have miss understood. i need the value to come from the database as well so, if i had the link and the id in the database is there a way that i could pull them both together  so i get the web address <a href="http://localhost/CS09/getimage.asp?id=" rel="nofollow">http://localhost/CS09/getimage.asp?id=</a> and then the ID, 10<br />
which will make <a href="http://localhost/CS09/getimage.asp?id=10" rel="nofollow">http://localhost/CS09/getimage.asp?id=10</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: linglom</title>
		<link>http://www.linglom.com/2008/09/01/create-dynamic-rss-feed-from-ms-sql-server-using-aspnet-part-ii-c/comment-page-1/#comment-4652</link>
		<dc:creator>linglom</dc:creator>
		<pubDate>Mon, 31 Aug 2009 04:24:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.linglom.com/?p=182#comment-4652</guid>
		<description>Hi, Max Allen
Yes, if you want to add a parameter to url, you can add on the end of the text value.

xml.WriteElementString(&quot;link&quot;, &quot;http://localhost/index.php?id=10&quot;);</description>
		<content:encoded><![CDATA[<p>Hi, Max Allen<br />
Yes, if you want to add a parameter to url, you can add on the end of the text value.</p>
<p>xml.WriteElementString(&#8220;link&#8221;, &#8220;http://localhost/index.php?id=10&#8243;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Max Allen</title>
		<link>http://www.linglom.com/2008/09/01/create-dynamic-rss-feed-from-ms-sql-server-using-aspnet-part-ii-c/comment-page-1/#comment-4645</link>
		<dc:creator>Max Allen</dc:creator>
		<pubDate>Wed, 26 Aug 2009 16:18:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.linglom.com/?p=182#comment-4645</guid>
		<description>wondering if anyone can help here. i have followed everything on the site and all works fine. what i am trying to do is to add another value in to the reader so when you click on the link it brings you to the website with a value on it need the extra code to add on to the end 
xml.WriteElementString(&quot;link&quot;, &quot;http://localhost/CS09/getimage.asp?id=&quot;)????????

is this possible ?</description>
		<content:encoded><![CDATA[<p>wondering if anyone can help here. i have followed everything on the site and all works fine. what i am trying to do is to add another value in to the reader so when you click on the link it brings you to the website with a value on it need the extra code to add on to the end<br />
xml.WriteElementString(&#8220;link&#8221;, &#8220;http://localhost/CS09/getimage.asp?id=&#8221;)????????</p>
<p>is this possible ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Geoff</title>
		<link>http://www.linglom.com/2008/09/01/create-dynamic-rss-feed-from-ms-sql-server-using-aspnet-part-ii-c/comment-page-1/#comment-4603</link>
		<dc:creator>Geoff</dc:creator>
		<pubDate>Thu, 06 Aug 2009 16:41:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.linglom.com/?p=182#comment-4603</guid>
		<description>I followed your article, but made some changes: with this code, you can publish more than 1 &quot;item&quot;


    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Clear();
        Response.ContentType = &quot;text/xml&quot;;

        XmlTextWriter xml = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);
        xml.WriteStartDocument();

        xml.WriteStartElement(&quot;rss&quot;);
        xml.WriteAttributeString(&quot;version&quot;, &quot;2.0&quot;);

        xml.WriteStartElement(&quot;channel&quot;);
        xml.WriteElementString(&quot;title&quot;, &quot;Test RSS Feed&quot;);
        xml.WriteElementString(&quot;link&quot;, &quot;http://testLink&quot;);
        xml.WriteElementString(&quot;description&quot;, &quot;This is example Feed from SQL Server&quot;);
        xml.WriteElementString(&quot;copyright&quot;, &quot;Copyright 2008. All rights reserved.&quot;);
        try
        {
            SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings[&quot;Users_Form_Data&quot;].ToString());
            SqlCommand myCommand = myConnection.CreateCommand();
            myCommand.CommandText = &quot;SELECT * FROM feeds ORDER BY date&quot;;
            SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);

            DataSet mySet = new DataSet();
            myAdapter.Fill(mySet);

            foreach (DataRow myRow in mySet.Tables[&quot;feeds&quot;].Rows)
            {
                xml.WriteStartElement(&quot;item&quot;);
                xml.WriteElementString(&quot;title&quot;, myRow[&quot;title&quot;].ToString());
                xml.WriteElementString(&quot;description&quot;, myRow[&quot;desc&quot;].ToString());
                xml.WriteElementString(&quot;link&quot;, myRow[&quot;link&quot;].ToString());
                xml.WriteElementString(&quot;pubDate&quot;, myRow[&quot;date&quot;].ToString());
                xml.WriteEndElement();

            }
        }
        catch { Response.Write(&quot;We are currenly experiencing Technical Difficulties&quot;); }
        xml.WriteEndElement();
        xml.WriteEndElement();
        xml.WriteEndDocument();
        xml.Flush();
        xml.Close();
        Response.End();
    }
</description>
		<content:encoded><![CDATA[<p>I followed your article, but made some changes: with this code, you can publish more than 1 &#8220;item&#8221;</p>
<p>    protected void Page_Load(object sender, EventArgs e)<br />
    {<br />
        Response.Clear();<br />
        Response.ContentType = &#8220;text/xml&#8221;;</p>
<p>        XmlTextWriter xml = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);<br />
        xml.WriteStartDocument();</p>
<p>        xml.WriteStartElement(&#8220;rss&#8221;);<br />
        xml.WriteAttributeString(&#8220;version&#8221;, &#8220;2.0&#8243;);</p>
<p>        xml.WriteStartElement(&#8220;channel&#8221;);<br />
        xml.WriteElementString(&#8220;title&#8221;, &#8220;Test RSS Feed&#8221;);<br />
        xml.WriteElementString(&#8220;link&#8221;, &#8220;http://testLink&#8221;);<br />
        xml.WriteElementString(&#8220;description&#8221;, &#8220;This is example Feed from SQL Server&#8221;);<br />
        xml.WriteElementString(&#8220;copyright&#8221;, &#8220;Copyright 2008. All rights reserved.&#8221;);<br />
        try<br />
        {<br />
            SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["Users_Form_Data"].ToString());<br />
            SqlCommand myCommand = myConnection.CreateCommand();<br />
            myCommand.CommandText = &#8220;SELECT * FROM feeds ORDER BY date&#8221;;<br />
            SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);</p>
<p>            DataSet mySet = new DataSet();<br />
            myAdapter.Fill(mySet);</p>
<p>            foreach (DataRow myRow in mySet.Tables["feeds"].Rows)<br />
            {<br />
                xml.WriteStartElement(&#8220;item&#8221;);<br />
                xml.WriteElementString(&#8220;title&#8221;, myRow["title"].ToString());<br />
                xml.WriteElementString(&#8220;description&#8221;, myRow["desc"].ToString());<br />
                xml.WriteElementString(&#8220;link&#8221;, myRow["link"].ToString());<br />
                xml.WriteElementString(&#8220;pubDate&#8221;, myRow["date"].ToString());<br />
                xml.WriteEndElement();</p>
<p>            }<br />
        }<br />
        catch { Response.Write(&#8220;We are currenly experiencing Technical Difficulties&#8221;); }<br />
        xml.WriteEndElement();<br />
        xml.WriteEndElement();<br />
        xml.WriteEndDocument();<br />
        xml.Flush();<br />
        xml.Close();<br />
        Response.End();<br />
    }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: linglom</title>
		<link>http://www.linglom.com/2008/09/01/create-dynamic-rss-feed-from-ms-sql-server-using-aspnet-part-ii-c/comment-page-1/#comment-4272</link>
		<dc:creator>linglom</dc:creator>
		<pubDate>Tue, 12 May 2009 02:14:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.linglom.com/?p=182#comment-4272</guid>
		<description>Hi, Von
You can send me a screenshot in the forum. Or you may post a comment with source code as text here.</description>
		<content:encoded><![CDATA[<p>Hi, Von<br />
You can send me a screenshot in the forum. Or you may post a comment with source code as text here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: von</title>
		<link>http://www.linglom.com/2008/09/01/create-dynamic-rss-feed-from-ms-sql-server-using-aspnet-part-ii-c/comment-page-1/#comment-4251</link>
		<dc:creator>von</dc:creator>
		<pubDate>Tue, 05 May 2009 11:06:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.linglom.com/?p=182#comment-4251</guid>
		<description>i have been trying but not really able to display everything in  format...please advise.</description>
		<content:encoded><![CDATA[<p>i have been trying but not really able to display everything in  format&#8230;please advise.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: von</title>
		<link>http://www.linglom.com/2008/09/01/create-dynamic-rss-feed-from-ms-sql-server-using-aspnet-part-ii-c/comment-page-1/#comment-4241</link>
		<dc:creator>von</dc:creator>
		<pubDate>Fri, 01 May 2009 12:22:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.linglom.com/?p=182#comment-4241</guid>
		<description>hmm...is it possible if i send you the screen shot of my web browser? so you have an idea of how it looks like?</description>
		<content:encoded><![CDATA[<p>hmm&#8230;is it possible if i send you the screen shot of my web browser? so you have an idea of how it looks like?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
