<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	>

<channel>
	<title>Aneef.Net &#187; .Net Related</title>
	<atom:link href="http://www.aneef.net/category/dotnet-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.aneef.net</link>
	<description>Do it in .Net way</description>
	<pubDate>Thu, 30 Oct 2008 08:54:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Compare and update XML File with the changes</title>
		<link>http://www.aneef.net/2008/10/30/compare-and-update-xml-file-with-the-changes/</link>
		<comments>http://www.aneef.net/2008/10/30/compare-and-update-xml-file-with-the-changes/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 08:46:50 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
		
		<category><![CDATA[.Net Related]]></category>

		<category><![CDATA[XML]]></category>

		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.aneef.net/2008/10/30/compare-and-update-xml-file-with-the-changes/</guid>
		<description><![CDATA[Recently I had a requirement to compare 2 XML Files, which has the existing and new settings of an application stored in them. what I wanted to do is when a new XML file of settings is arrived, I had to compare and retain the existing settings, and add any new ones if there are [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had a requirement to compare 2 XML Files, which has the existing and new settings of an application stored in them. what I wanted to do is when a new XML file of settings is arrived, I had to compare and retain the existing settings, and add any new ones if there are any, remove any settings if they are removed in the new one. Mainly I needed to compare nodes as well as attributes.</p>
<p>Here are few suggestion I got from my friends and communities:</p>
<ol>
<li><a href="http://msdn.microsoft.com/en-us/library/aa302294.aspx" target="_blank">XML Diff Patch</a> - Couldn&#8217;t achieve what I wanted. </li>
<li><a href="http://msdn.microsoft.com/en-us/library/bb387098.aspx" target="_blank">Linq for XML</a> -&#160; I cannot use this as the application is developed under .net Framework 2.0 </li>
</ol>
<p>&#160;</p>
<p>So after Several Discussions and Forum Posts I Decided to Write one on my own. I don&#8217;t know whether it is the best, but it servers for my purpose. so just thought of sharing it with you all, as I saw there were a lot with the same problem. I know&#160; it needs some improvements such as comparing nested nodes and attributes. but&#160; this would be a better kick start. &quot;something is better than nothing&quot; right!!!.</p>
<p>&#160;</p>
<p>Here are two sample XML files which we can use for our comparison, and the output expected.</p>
<p>&#160;</p>
<p><u>Existing Settings</u></p>
<pre class="csharpcode">&lt;Properties xmlns:xsi=<span class="str"><a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a></span></pre>
<pre class="csharpcode"><span class="str"></span> xmlns:xsd=<span class="str">&quot;http://www.w3.org/2001/XMLSchema&quot;</span>&gt;
    &lt;Property Name=<span class="str">&quot;PerformanceType1&quot;</span> ProID=<span class="str">&quot;1&quot;</span> Text=<span class="str">&quot;Gross&quot;</span></pre>
<pre class="csharpcode"><span class="str"></span> Type=<span class="str">&quot;ddlb&quot;</span> Values=<span class="str">&quot;On|Off&quot;</span>&gt;On&lt;/Property&gt;
    &lt;Property Name=<span class="str">&quot;Benchmark1&quot;</span> ProID=<span class="str">&quot;3&quot;</span> Text=<span class="str">&quot;Benchmark 1&quot;</span> Type=<span class="str">&quot;ddlb&quot;</span></pre>
<pre class="csharpcode"><span class="str"></span> Values=<span class="str">&quot;N/A|2nd Security Index&quot;</span>&gt;N/A&lt;/Property&gt;
    &lt;Property Name=<span class="str">&quot;Benchmark2&quot;</span> ProID=<span class="str">&quot;4&quot;</span> Text=<span class="str">&quot;Benchmark 2&quot;</span> Type=<span class="str">&quot;ddlb&quot;</span></pre>
<pre class="csharpcode"><span class="str"></span> Values=<span class="str">&quot;N/A|2nd Security Index&quot;</span>&gt;N/A&lt;/Property&gt;
    &lt;Property Name=<span class="str">&quot;Region1&quot;</span> ProID=<span class="str">&quot;7&quot;</span> Text=<span class="str">&quot;Column 1&quot;</span> Type=<span class="str">&quot;ddlb&quot;</span> </pre>
<pre class="csharpcode">Values=<span class="str">&quot;N/A|1 Month|2 Month|3&quot;</span>&gt;1 Month&lt;/Property&gt;
    &lt;Property Name=<span class="str">&quot;FromDate1&quot;</span> ProID=<span class="str">&quot;8&quot;</span> Text=<span class="str">&quot;Column 1 From&quot;</span> </pre>
<pre class="csharpcode">Type=<span class="str">&quot;Date&quot;</span>&gt;N/A&lt;/Property&gt;
    &lt;Property Name=<span class="str">&quot;FromDate9&quot;</span> ProID=<span class="str">&quot;24&quot;</span> Text=<span class="str">&quot;Column 9 From&quot;</span> </pre>
<pre class="csharpcode">Type=<span class="str">&quot;Date&quot;</span>&gt;N/A&lt;/Property&gt;
&lt;/Properties&gt;</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p><u></u></p>
<p>&#160;</p>
<p><u>New Settings</u></p>
<pre class="csharpcode">&lt;Properties xmlns:xsi=<span class="str"><a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a></span> </pre>
<pre class="csharpcode">xmlns:xsd=<span class="str">&quot;http://www.w3.org/2001/XMLSchema&quot;</span>&gt;
    &lt;Property Name=<span class="str">&quot;PerformanceType1&quot;</span> ProID=<span class="str">&quot;1&quot;</span> Text=<span class="str">&quot;Gross&quot;</span></pre>
<pre class="csharpcode"><span class="str"></span> Type=<span class="str">&quot;ddlb&quot;</span> Values=<span class="str">&quot;On|Off&quot;</span>&gt;On&lt;/Property&gt;
    &lt;Property Name=<span class="str">&quot;Benchmark1&quot;</span> ProID=<span class="str">&quot;3&quot;</span> Text=<span class="str">&quot;Benchmark 1&quot;</span> </pre>
<pre class="csharpcode">Type=<span class="str">&quot;ddlb&quot;</span> Values=<span class="str">&quot;N/A|2nd Security Index&quot;</span>&gt;changed&lt;/Property&gt;
    &lt;Property Name=<span class="str">&quot;Benchmark2&quot;</span> ProID=<span class="str">&quot;4&quot;</span> Text=<span class="str">&quot;Benchmark 2&quot;</span> </pre>
<pre class="csharpcode">Type=<span class="str">&quot;ddlb&quot;</span> Values=<span class="str">&quot;N/A|2nd Security Index&quot;</span>&gt;N/A&lt;/Property&gt;
    &lt;Property Name=<span class="str">&quot;Region1&quot;</span> ProID=<span class="str">&quot;9&quot;</span> Text=<span class="str">&quot;Changed&quot;</span> </pre>
<pre class="csharpcode">Type=<span class="str">&quot;ddlb&quot;</span> Values=<span class="str">&quot;N/A|1 Month|2 Month|3&quot;</span>&gt;1 Month&lt;/Property&gt;
    &lt;Property Name=<span class="str">&quot;NewData&quot;</span> ProID=<span class="str">&quot;29&quot;</span> Text=<span class="str">&quot;Column 9 From&quot;</span> </pre>
<pre class="csharpcode">Type=<span class="str">&quot;Date&quot;</span>&gt;NewlyAdded&lt;/Property&gt;
    &lt;Property Name=<span class="str">&quot;FromDate9&quot;</span> ProID=<span class="str">&quot;24&quot;</span> Text=<span class="str">&quot;Column 9 From&quot;</span> </pre>
<pre class="csharpcode">Type=<span class="str">&quot;Date&quot;</span>&gt;N/A&lt;/Property&gt;
&lt;/Properties&gt;</pre>
<pre class="csharpcode">&#160;</pre>
<pre class="csharpcode"><u>Expected Output</u></pre>
<pre class="csharpcode"><u></u>&#160;</pre>
<pre class="csharpcode">&lt;Properties xmlns:xsi=<span class="str"><a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a></span></pre>
<pre class="csharpcode"><span class="str"></span> xmlns:xsd=<span class="str">&quot;http://www.w3.org/2001/XMLSchema&quot;</span>&gt;
    &lt;Property Name=<span class="str">&quot;PerformanceType1&quot;</span> ProID=<span class="str">&quot;1&quot;</span> Text=<span class="str">&quot;Gross&quot;</span> </pre>
<pre class="csharpcode">Type=<span class="str">&quot;ddlb&quot;</span> Values=<span class="str">&quot;On|Off&quot;</span>&gt;On&lt;/Property&gt;
    &lt;Property Name=<span class="str">&quot;Benchmark1&quot;</span> ProID=<span class="str">&quot;3&quot;</span> Text=<span class="str">&quot;Benchmark 1&quot;</span></pre>
<pre class="csharpcode"><span class="str"></span> Type=<span class="str">&quot;ddlb&quot;</span> Values=<span class="str">&quot;N/A|2nd Security Index&quot;</span>&gt;N/A&lt;/Property&gt;
    &lt;Property Name=<span class="str">&quot;Benchmark2&quot;</span> ProID=<span class="str">&quot;4&quot;</span> Text=<span class="str">&quot;Benchmark 2&quot;</span></pre>
<pre class="csharpcode"><span class="str"></span> Type=<span class="str">&quot;ddlb&quot;</span> Values=<span class="str">&quot;N/A|2nd Security Index&quot;</span>&gt;N/A&lt;/Property&gt;
    &lt;Property Name=<span class="str">&quot;Region1&quot;</span> ProID=<span class="str">&quot;9&quot;</span> Text=<span class="str">&quot;Changed&quot;</span></pre>
<pre class="csharpcode"><span class="str"></span> Type=<span class="str">&quot;ddlb&quot;</span> Values=<span class="str">&quot;N/A|1 Month|2 Month|3&quot;</span>&gt;1 Month&lt;/Property&gt;
    &lt;Property Name=<span class="str">&quot;FromDate9&quot;</span> ProID=<span class="str">&quot;24&quot;</span> Text=<span class="str">&quot;Column 9 From&quot;</span></pre>
<pre class="csharpcode"><span class="str"></span> Type=<span class="str">&quot;Date&quot;</span>&gt;N/A&lt;/Property&gt;
    &lt;Property Name=<span class="str">&quot;NewData&quot;</span> ProID=<span class="str">&quot;29&quot;</span> Text=<span class="str">&quot;Column 9 From&quot;</span></pre>
<pre class="csharpcode"><span class="str"></span> Type=<span class="str">&quot;Date&quot;</span>&gt;NewlyAdded&lt;/Property&gt;
&lt;/Properties&gt;</pre>
<pre class="csharpcode">&#160;</pre>
<pre class="csharpcode">&#160;</pre>
<pre class="csharpcode">&#160;</pre>
<p>And now Lets see how the code works:</p>
<pre class="csharpcode">&#160;</pre>
<pre class="csharpcode"><span class="kwrd">string</span> original = File.ReadAllText(<span class="str">@&quot;&lt;Original File path&gt;&quot;</span>);
<span class="kwrd">string</span> New = File.ReadAllText(<span class="str">@&quot;&lt;New File path&gt;&quot;</span>);
XmlCompare compare = <span class="kwrd">new</span> XmlCompare();
XmlDocument docs=compare.compare(original, New);
File.WriteAllText(<span class="str">@&quot;&lt;output path&gt;&quot;</span>, docs.OuterXml);</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<pre class="csharpcode">&#160;</pre>
<pre class="csharpcode">&#160;</pre>
<p>The Implementation of the code and its functionality is given in the below download file, with inline comments.</p>
<p>Please note few values are hard coded in this class, but can be altered to suit the requirements.</p>
<p><strong><a href="http://www.aneef.net/wp-content/uploads/2008/10/XMLCompare.cs" target="_blank">XMLCompare.cs</a></strong></p>
<p>I hope it helps for a kick start!.</p>
<p>&#160;</p>
<pre class="csharpcode">&#160;</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2008/10/30/compare-and-update-xml-file-with-the-changes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>44 Silverlight 2.0 Videos</title>
		<link>http://www.aneef.net/2008/08/02/44-silverlight-20-videos/</link>
		<comments>http://www.aneef.net/2008/08/02/44-silverlight-20-videos/#comments</comments>
		<pubDate>Sat, 02 Aug 2008 19:35:10 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
		
		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[visual studio 2008]]></category>

		<guid isPermaLink="false">http://www.aneef.net/2008/08/02/44-silverlight-20-videos/</guid>
		<description><![CDATA[Are you searching  for webcasts to learn about Microsoft Silverlight 2.0 ? well then, here is a good news for you all.Mike Taulty recently uploaded and amazing collection of Silverlight 2.0 screencasts on how Silverlight works, controls, File IO, networking, UI design,  data-binding, interacting with HTML pages, and more.if you want to have a good [...]]]></description>
			<content:encoded><![CDATA[<p>Are you searching  for webcasts to learn about <a href="http://silverlight.net/default.aspx">Microsoft Silverlight </a>2.0 ? well then, here is a good news for you all.<a href="http://mtaulty.com/communityserver/blogs/mike_taultys_blog/default.aspx">Mike Taulty</a> recently uploaded and amazing collection of Silverlight 2.0 screencasts on how Silverlight works, controls, File IO, networking, UI design,  data-binding, interacting with HTML pages, and more.if you want to have a good start on Silverlight, then go get them!. it will help you for sure.</p>
<p><a href="http://www.aneef.net/wp-content/uploads/2008/08/windowslivewriter44silverlight20videos-1031silverlight-2.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" src="http://www.aneef.net/wp-content/uploads/2008/08/windowslivewriter44silverlight20videos-1031silverlight-thumb.png" border="0" alt="silverlight" width="244" height="184" /></a></p>
<ol>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Hello-World/"><strong>Silverlight - Hello World</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Anatomy-of-an-Application/"><strong>Silverlight - Anatomy of an Application</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-The-VS-Environment/"><strong>Silverlight - The VS Environment</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Content-Controls/"><strong>Silverlight - Content Controls</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Built-In-Controls/"><strong>Silverlight - Built-In Controls</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Width-Height-Margins-Padding-Alignment/"><strong>Silverlight - Width, Height, Margins, Padding, Alignment</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Using-a-GridSplitter/"><strong>Silverlight - Using a GridSplitter</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Grid-Layout/"><strong>Silverlight - Grid Layout</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-StackPanel-Layout/"><strong>Silverlight - StackPanel Layout</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Canvas-Layout/"><strong>Silverlight - Canvas Layout</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Databinding-UI-to-NET-Classes/"><strong>Silverlight - Databinding UI to .NET Classes</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Simple-Styles/"><strong>Silverlight - Simple Styles</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Custom-Types-in-XAML/"><strong>Silverlight - Custom Types in XAML</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Binding-with-Conversion/"><strong>Silverlight - Binding with Conversion</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-List-Based-Data-Binding/"><strong>Silverlight - List Based Data Binding</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Simple-User-Control/"><strong>Silverlight - Simple User Control</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Templating-a-Button/"><strong>Silverlight - Templating a Button</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Resources-from-XAPDLLSite-Of-Origin/"><strong>Silverlight - Resources from XAP/DLL/Site Of Origin</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Animations--Storyboards/"><strong>Silverlight - Animations &amp; Storyboards</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Uploads-with-WebClient/"><strong>Silverlight - Uploads with WebClient</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Downloads-with-WebClient/"><strong>Silverlight - Downloads with WebClient</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Calling-HTTPS-Web-Services/"><strong>Silverlight - Calling HTTPS Web Services</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Calling-Web-Services/"><strong>Silverlight - Calling Web Services</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Making-Cross-Domain-Requests/"><strong>Silverlight - Making Cross Domain Requests</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Using-HttpWebRequest/"><strong>Silverlight - Using HttpWebRequest</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-File-Dialogs-and-User-Files/"><strong>Silverlight - File Dialogs and User Files</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Using-Sockets/"><strong>Silverlight - Using Sockets</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Using-Isolated-Storage/"><strong>Silverlight - Using Isolated Storage</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-NET-Code-Modifying-HTML/"><strong>Silverlight - .NET Code Modifying HTML</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Using-Isolated-Storage-Quotas/"><strong>Silverlight - Using Isolated Storage Quotas</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Calling-JavaScript-from-NET/"><strong>Silverlight - Calling JavaScript from .NET</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Evaluating-JavaScript-from-NET-Code/"><strong>Silverlight - Evaluating JavaScript from .NET Code</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Handling-HTML-Events-in-NET-Code/"><strong>Silverlight - Handling HTML Events in .NET Code</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Handling-NET-Events-in-JavaScript/"><strong>Silverlight - Handling .NET Events in JavaScript</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Calling-NET-from-JavaScript/"><strong>Silverlight - Calling .NET from JavaScript</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Displaying-a-Custom-Splash-Screen/"><strong>Silverlight - Displaying a Custom Splash Screen</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Passing-Parameters-from-your-Web-Page/"><strong>Silverlight - Passing Parameters from your Web Page</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Loading-Media-at-Runtime/"><strong>Silverlight - Loading Media at Runtime</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Dynamically-Loading-AssembliesCode/"><strong>Silverlight - Dynamically Loading Assemblies/Code</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-ReadingWriting-XML/"><strong>Silverlight - Reading/Writing XML</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Using-Silverlight-Streaming/"><strong>Silverlight - Multiple Threads with BackgroundWorker</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-InsertUpdateDelete-with-the-DataGrid/"><strong>Silverlight - Insert/Update/Delete with the DataGrid</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Getting-Started-with-the-DataGrid/"><strong>Silverlight - Getting Started with the DataGrid</strong></a></li>
<li><a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Embedding-Custom-Fonts/"><strong>Silverlight - Embedding Custom Fonts</strong></a></li>
</ol>
<ol>Thats it!. Have  a great weekend!!.</ol>
<p><script type="text/javascript"><!--
google_ad_client = "pub-3530459083226419";
/* testadd */
google_ad_slot = "3104422232";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2008/08/02/44-silverlight-20-videos/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Create Excel Sheets Programmatically with C# without Installing Excel.</title>
		<link>http://www.aneef.net/2008/07/25/create-excel-sheets-programmatically-with-c-without-installing-excel/</link>
		<comments>http://www.aneef.net/2008/07/25/create-excel-sheets-programmatically-with-c-without-installing-excel/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 07:10:01 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
		
		<category><![CDATA[.Net Related]]></category>

		<category><![CDATA[ADO.net]]></category>

		<category><![CDATA[Libraries]]></category>

		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.aneef.net/2008/07/25/create-excel-sheets-programmatically-with-c-without-installing-excel/</guid>
		<description><![CDATA[Here goes one more needy component for developers. a lot of developers always had a problem of exporting data to excel programmatically. if you Google this topic you will get many results regarding this. here are some which caught my eyes.

How To Use ADO.NET to Retrieve and Modify Records in an Excel Workbook With Visual [...]]]></description>
			<content:encoded><![CDATA[<p>Here goes one more needy component for developers. a lot of developers always had a problem of exporting data to excel programmatically. if you Google this topic you will get many results regarding this. here are some which caught my eyes.</p>
<ol>
<li><a href="http://support.microsoft.com/kb/316934" target="_blank">How To Use ADO.NET to Retrieve and Modify Records in an Excel Workbook With Visual Basic .NET</a></li>
<li><a href="http://www.codeproject.com/KB/office/datasettoexcel.aspx" target="_blank">DataSet to Excel in Two steps – with Different Styles- by Krishna_accent</a></li>
<li> And finally comes our good old CSV files. </li>
</ol>
<p>the first one seems to be ok. but have little more work to be done on coding. the second is a&nbsp; really good one, but again we need excel to be installed, which again run out of our needs.</p>
<p>using CSV is ok for unformatted Comma Separated Values. </p>
<p>&nbsp;</p>
<p>But Recently I found <a href="http://www.carlosag.net/default.aspx?id=1" target="_blank">Carlos Aguilar Mares</a> has this wonderful FREE component called <a href="http://www.carlosag.net/Tools/ExcelXmlWriter/Default.aspx" target="_blank">ExcelXmlWriter</a> , to export data to excel. it doesn&#8217;t need excel to be installed and it can be used to generate formatted excel workbooks with very few lines of code. </p>
<p>&nbsp;</p>
<div class="csharpcode">
<pre><span class="lnum">   1:  </span><span class="kwrd">using</span> CarlosAg.ExcelXmlWriter;</pre>
<pre><span class="lnum">   2:  </span>&nbsp;</pre>
<pre><span class="lnum">   3:  </span><span class="kwrd">class</span> TestApp {</pre>
<pre><span class="lnum">   4:  </span>    <span class="kwrd">static</span> <span class="kwrd">void</span> Main(<span class="kwrd">string</span>[] args) {</pre>
<pre><span class="lnum">   5:  </span>        Workbook book = <span class="kwrd">new</span> Workbook();</pre>
<pre><span class="lnum">   6:  </span>        Worksheet sheet = book.Worksheets.Add(<span class="str">"Sample"</span>);</pre>
<pre><span class="lnum">   7:  </span>        WorksheetRow row =  sheet.Table.Rows.Add();</pre>
<pre><span class="lnum">   8:  </span>        row.Cells.Add(<span class="str">"Hello World"</span>);</pre>
<pre><span class="lnum">   9:  </span>        book.Save(<span class="str">@"c:\test.xls"</span>);</pre>
<pre><span class="lnum">  10:  </span>    }</pre>
<pre><span class="lnum">  11:  </span>}</pre>
</div>
<p><style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
</p>
<p>the download has a very easy to understand help file explaining how to use this. you can download it in his website <a href="http://www.carlosag.net/Tools/ExcelXmlWriter/Default.aspx" target="_blank">here</a>.</p>
<p>Clean and simple isn&#8217;t it ?</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-3530459083226419";
/* Image only In POst */
google_ad_slot = "2791845940";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2008/07/25/create-excel-sheets-programmatically-with-c-without-installing-excel/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Create PDF Files on the fly with C# and PDFSharp</title>
		<link>http://www.aneef.net/2008/07/24/create-pdf-files-on-the-fly-with-c-and-pdfsharp/</link>
		<comments>http://www.aneef.net/2008/07/24/create-pdf-files-on-the-fly-with-c-and-pdfsharp/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 12:36:19 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
		
		<category><![CDATA[Libraries]]></category>

		<category><![CDATA[Visual Studio]]></category>

		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.aneef.net/2008/07/24/create-pdf-files-on-the-fly-with-c-and-pdfsharp/</guid>
		<description><![CDATA[Recently one of my colleague asked me is there anyway to programmatically merge huge number of PDF  files in to a single file, without using Adobe Acrobat libraries, well the answer is yeah. and there are a lot of off the shelve and open source libraries available for this. the best one I found is [...]]]></description>
			<content:encoded><![CDATA[<p>Recently one of my colleague asked me is there anyway to programmatically merge huge number of PDF  files in to a single file, without using Adobe Acrobat libraries, well the answer is yeah. and there are a lot of off the shelve and open source libraries available for this. the best one I found is the <a href="http://www.pdfsharp.com/PDFsharp/" target="_blank">PDFSharp</a>, and its totally FREE.</p>
<p>Here is a little introduction about PDFSharp:</p>
<ul>
<li>PDFsharp is the Open Source library that easily creates PDF documents from any .NET language.<br />
The same drawing routines can be used to create PDF documents, draw on the screen, or send output to any printer.</li>
<li>It can use either GDI+ or WPF.</li>
<li>It includes support for Unicode in PDF files.</li>
<li>It also includes MigraDoc Lite which brings you all the high-level functionality not included in PDFsharp.</li>
</ul>
<p>Using PDFSharp is very simple. the samples in the official download file are more than enough to learn the functionality of PDFSharp.here is a little piece of code I used to merge A collection of PDFs in a folder to a single PDF file.</p>
<div class="csharpcode">
<pre><span class="lnum">   1:  </span>PdfDocument inputDocument=</pre>
<pre><span class="lnum">   2:  </span>                PdfReader.Open(file.FullName,PdfDocumentOpenMode.Import);</pre>
<pre><span class="lnum">   3:  </span><span class="kwrd">int</span> count = inputDocument.PageCount;</pre>
<pre><span class="lnum">   4:  </span>  <span class="kwrd">for</span> (<span class="kwrd">int</span> idx = 0; idx &lt; count; idx++)</pre>
<pre><span class="lnum">   5:  </span>   {</pre>
<pre><span class="lnum">   6:  </span>       <span class="rem">// Get the page from the external document...</span></pre>
<pre><span class="lnum">   7:  </span>       PdfPage page = inputDocument.Pages[idx];</pre>
<pre><span class="lnum">   8:  </span>       <span class="rem">// ...and add it to the output document.</span></pre>
<pre><span class="lnum">   9:  </span>       outputDocument.AddPage(page);</pre>
<pre><span class="lnum">  10:  </span>   }</pre>
<pre><span class="lnum">  11:  </span></pre>
<pre><span class="lnum">  12:  </span>outputDocument.Save(filename);</pre>
</div>
<p>if you want to download the full sample I created download it  <a href="http://www.aneef.net/wp-content/uploads/2008/06/pdfMerge.zip" target="_blank">here</a>.</p>
<p>if you want to download pdfSharp Library visit the site below:</p>
<p><a title="http://www.pdfsharp.com/PDFsharp" href="http://www.pdfsharp.com/PDFsharp">http://www.pdfsharp.com/PDFsharp</a></p>
<p><!--adsense#inpost--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2008/07/24/create-pdf-files-on-the-fly-with-c-and-pdfsharp/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MSDN Reader!! A Must Have Application!</title>
		<link>http://www.aneef.net/2008/02/26/msdn-reader-a-must-have-application/</link>
		<comments>http://www.aneef.net/2008/02/26/msdn-reader-a-must-have-application/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 10:03:12 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
		
		<category><![CDATA[Interesting]]></category>

		<category><![CDATA[MSDN]]></category>

		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Technology]]></category>

		<category><![CDATA[Visual Studio]]></category>

		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.aneef.net/2008/02/26/msdn-reader-a-must-have-application/</guid>
		<description><![CDATA[www.windowsclient.net have released a new &#34;Syndicated Client Starter Kit&#34; designed to make it easy to create rich, syndicated multimedia and content experiences which engage the user, from documents and photos to videos and podcasts.you can read the story here.
And this Starter Kit Show case includes an awsum MSDN Reader. The MSDN Reader allows you to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.windowsclient.net">www.windowsclient.net</a> have released a new &quot;Syndicated Client Starter Kit&quot; designed to make it easy to create rich, syndicated multimedia and content experiences which engage the user, from documents and photos to videos and podcasts.you can read the story <a href="http://windowsclient.net/wpf/starter-kits/sce.aspx" target="_blank">here</a>.</p>
<p>And this Starter Kit Show case includes an awsum <a href="http://windowsclient.net/apps/MsdnReaderSetup.exe" target="_blank">MSDN Reader</a>. The MSDN Reader allows you to browse through <a href="http://msdn.microsoft.com/msdnmag/" target="_blank">MSDN Magazine</a> articles like never before. Read through articles, view figures and code snippets in an intuitive and easy-to-use experience. The complete source code for the reader is also provided for us to download <a href="http://windowsclient.net/apps/MsdnReaderSourceCode.exe">here</a>.</p>
<p><img height="333" src="http://windowsclient.net/Themes/leanandgreen/images/sce/msdn_reader_new.jpg" width="477" /> </p>
<p>Its totally free. and I would say its a must have for we developers. so what are you waiting for install it!</p>
<p><a href="http://windowsclient.net/apps/MsdnReaderSetup.exe" target="_blank">Download it here</a>    <br /><a href="http://windowsclient.net/apps/MsdnReaderSourceCode.exe" target="_blank">Source Code</a>    <br /><a href="http://windowsclient.net/wpf/starter-kits/sce.aspx" target="_blank">Syndication Starter Kit home</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2008/02/26/msdn-reader-a-must-have-application/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Visual Studio 2008, C# 3.0, LINQ, ASP.Net 3.5 Getting Started</title>
		<link>http://www.aneef.net/2008/02/18/visual-studio-2008-c-30-linq-aspnet-35-getting-started/</link>
		<comments>http://www.aneef.net/2008/02/18/visual-studio-2008-c-30-linq-aspnet-35-getting-started/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 07:35:52 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
		
		<category><![CDATA[ASP.Net]]></category>

		<category><![CDATA[LINQ]]></category>

		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[Visual Studio]]></category>

		<category><![CDATA[WPF]]></category>

		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.aneef.net/2008/02/18/visual-studio-2008-c-30-linq-aspnet-35-getting-started/</guid>
		<description><![CDATA[these days I&#8217;m just playing around with Visual studio 2008 and its new features, C# 3.0 LINQ, Windows Presentation Foundation, Silverlight, ASP.Net 3.5 and much more. And trust me last few months, I have received a lot of emails regarding How to&#8217;s of these and requesting resources to learn these language improvements. well may be [...]]]></description>
			<content:encoded><![CDATA[<p>these days I&#8217;m just playing around with Visual studio 2008 and its new features, <a href="http://msdn2.microsoft.com/en-us/library/bb308966.aspx" target="_blank">C# 3.0</a> <a href="http://msdn2.microsoft.com/en-us/netframework/aa904594.aspx" target="_blank">LINQ</a>, <a href="http://wpf.netfx3.com/" target="_blank">Windows Presentation Foundation</a>, <a href="http://silverlight.net/" target="_blank">Silverlight</a>, ASP.Net 3.5 and much more. And trust me last few months, I have received a lot of emails regarding How to&#8217;s of these and requesting resources to learn these language improvements. well may be you  wonder why I get these requests while there are a lot of geek&#8217;s outs there.. well trust me I do have some fans!!.</p>
<p>so I decided to help them all out, but I don&#8217;t want to fill the blogsphere with another post of LINQ, WPF or WCF, because its already filled with a lot of articles on them by geek&#8217;s and various people around the world.so what I&#8217;m going to do is post some valuable links on where you can give a kick start on learning these.</p>
<p><center><!--adsense#inpost--></center></p>
<ol>
<li>To get visual studio 2008 read the post <a href="http://www.aneef.net/2007/11/23/visual-studio-2008-orcas-is-here/" target="_blank">here</a>.</li>
<li>The first and best place I would recommend to learn is reading Scott Guthrie&#8217;s web blog. he had written some excellent articles on these new technologies. I would recommend you to subscribe his blogs feeds or book marking his blog for future reference. here is are some valuable articles by him.
<ol>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/01/28/video-using-linq-with-asp-net-in-vs-orcas-part-1.aspx" target="_blank">Using LINQ with ASP.Net in VS 2008</a>.</li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/02/08/my-first-look-at-orcas-presentation.aspx" target="_blank">Scott Guthrie - First Look at ORCAS</a>.</li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/03/08/new-c-orcas-language-features-automatic-properties-object-initializers-and-collection-initializers.aspx" target="_blank">New &#8220;ORCAS&#8221; C# 3.0 Language Features: Automatic Properties, Object Initializers and Collection Initializers</a>.</li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/03/13/new-orcas-language-feature-extension-methods.aspx" target="_blank">New &#8220;ORCAS&#8221; Language Features : Extension Methods</a>.</li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/04/08/new-orcas-language-feature-lambda-expressions.aspx" target="_blank">New &#8220;ORCAS&#8221; Language Features : Lambda Expressions</a>.</li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/04/21/new-orcas-language-feature-query-syntax.aspx" target="_blank">New &#8220;ORCAS&#8221; Language Features : Query Syntax</a>.</li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/05/15/new-orcas-language-feature-anonymous-types.aspx" target="_blank">New &#8220;ORCAS&#8221; Language Features :  Anonymous Types</a>.</li>
<li>and the following are Scott&#8217;s posts on LINQ
<ul>
<li>
<ul>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx">Part 1: Introduction to LINQ to SQL</a></li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/05/29/linq-to-sql-part-2-defining-our-data-model-classes.aspx">Part 2: Defining our Data Model Classes</a></li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/06/29/linq-to-sql-part-3-querying-our-database.aspx">Part 3: Querying our Database</a></li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/07/11/linq-to-sql-part-4-updating-our-database.aspx">Part 4: Updating our Database</a></li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/07/16/linq-to-sql-part-5-binding-ui-using-the-asp-linqdatasource-control.aspx">Part 5: Binding UI using the ASP:LinqDataSource Control</a></li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/08/16/linq-to-sql-part-6-retrieving-data-using-stored-procedures.aspx">Part 6: Retrieving Data Using Stored Procedures</a></li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/08/23/linq-to-sql-part-7-updating-our-database-using-stored-procedures.aspx">Part 7: Updating our Database using Stored Procedures</a></li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/08/27/linq-to-sql-part-8-executing-custom-sql-expressions.aspx">Part 8: Executing Custom SQL Expressions</a></li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/09/07/linq-to-sql-part-9-using-a-custom-linq-expression-with-the-lt-asp-linqdatasource-gt-control.aspx" target="_blank">Part 9: Using a Custom LINQ Expression with the Control</a></li>
</ul>
</li>
</ul>
</li>
</ol>
</li>
<li>Another Place to Learn About LINQ is  <a href="http://linqinaction.net/blogs/default.aspx" target="_blank">LINQ in Action</a> . this site with its popularity has been written as a book  also for more information visit <a href="http://linqinaction.net/blogs/main/archive/2008/02/02/here-it-is-the-linq-in-action-paper-book.aspx" target="_blank">here</a>.</li>
<li>And now for WPF. here are the web sites which helped me to build my WPF knowledge.
<ol>
<li><a href="http://windowsclient.net/learn/videos_wpf.aspx" target="_blank">Windows Client official web site WPF Video Tutorials</a></li>
<li><a href="http://www.contentpresenter.com/" target="_blank">The Content Presenter</a></li>
<li><a href="http://thewpfblog.com/index.php" target="_blank">The WPF Blog</a></li>
</ol>
</li>
<li>And so far to lean <a href="http://www.silverlight.net" target="_blank">Silverlight</a> would recommend the official <a href="http://www.silverlight.net" target="_blank">Silverlight web site</a>.</li>
<li>and below are some more links which you might be interested in:
<ol>
<li><a href="http://blogs.msdn.com/pfxteam/default.aspx" target="_blank">Parallel Language Integrated Query (PLINQ)</a></li>
<li><a href="http://www.asp.net/learn/3.5-videos/" target="_blank">ASP.Net 3.5 Video Tutorials</a>.</li>
<li><a href="http://msdn2.microsoft.com/en-us/vcsharp/aa336746.aspx" target="_blank">101 LINQ Samples</a>.</li>
<li>Xceed WPF Data Grid Component -<a href="http://xceed.com/Grid_WPF_New.html" target="_blank">Free full Version</a> (1 Developer Licence ).</li>
</ol>
</li>
<li>And finally <a href="http://www.microsoft.com/Downloads/details.aspx?familyid=8BDAA836-0BBA-4393-94DB-6C3C4A0C98A1&amp;displaylang=en" target="_blank">The Official Visual studio 2008 training kit by Microsoft</a></li>
</ol>
<p>Well These are the sites which I visit often to learn about these new technologies. I&#8217;m just sharing these with you to make it easy to find about these and  learn them easily without spending much time to search for these.</p>
<p>I hope it helped you, Enjoy!!.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2008/02/18/visual-studio-2008-c-30-linq-aspnet-35-getting-started/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Show Site Map Description on ASP.Net 2.0 Menu Control</title>
		<link>http://www.aneef.net/2008/02/13/show-site-map-description-on-aspnet-20-menu-control/</link>
		<comments>http://www.aneef.net/2008/02/13/show-site-map-description-on-aspnet-20-menu-control/#comments</comments>
		<pubDate>Wed, 13 Feb 2008 06:23:41 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
		
		<category><![CDATA[ASP.Net]]></category>

		<guid isPermaLink="false">http://www.aneef.net/2008/02/13/show-site-map-description-on-aspnet-20-menu-control/</guid>
		<description><![CDATA[Recently one of my Friend Asked me, how do I display both the title and the description of the SiteMapNode in the ASP.Net menu control ? well unfortunately by default ASP.Net Menu doesn&#8217;t support this.because the menu binds directly to a MenuItem object. and the MenuItem does expose a DataItem Property,but when it is added [...]]]></description>
			<content:encoded><![CDATA[<p>Recently one of my Friend Asked me, how do I display both the title and the description of the <a href="http://msdn2.microsoft.com/en-us/library/7as0bse6.aspx" target="_blank">SiteMapNode</a> in the <a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.menu.aspx" target="_blank">ASP.Net menu control</a> ? well unfortunately by default ASP.Net Menu doesn&#8217;t support this.because the menu binds directly to a <a href="http://msdn2.microsoft.com/en-us/library/7as0bse6.aspx" target="_blank">MenuItem</a> object. and the MenuItem does expose a DataItem Property,but when it is added to the menu, it has no longer reference to the SiteMapNode which is used to populate it.</p>
<p>But we can write our own custom methods in your classes to Achieve this requirement, by looking at the SiteMapNode based on its title or URI. a sample is given below:</p>
<div class="csharpcode">
<pre><span class="lnum">   1:  </span><span class="kwrd">private</span> <span class="kwrd">string</span> menuDescription=<span class="kwrd">string</span>.Empty;</pre>
<pre><span class="lnum">   2:  </span>&nbsp;</pre>
<pre><span class="lnum">   3:  </span><span class="kwrd">protected</span> <span class="kwrd">string</span> GetDescriptionByTitle(<span class="kwrd">string</span> title)</pre>
<pre><span class="lnum">   4:  </span>{</pre>
<pre><span class="lnum">   5:  </span><span class="rem">/*this assumes that there is only one node with this title.</span></pre>
<pre><span class="lnum">   6:  </span><span class="rem">which is a standard in asp.net SiteMap Development*/</span></pre>
<pre><span class="lnum">   7:  </span>&nbsp;</pre>
<pre><span class="lnum">   8:  </span>SiteMapNode node = SiteMap.RootNode;</pre>
<pre><span class="lnum">   9:  </span>SearchForDesc(node, title);</pre>
<pre><span class="lnum">  10:  </span><span class="kwrd">return</span> menuDescription;</pre>
<pre><span class="lnum">  11:  </span>}</pre>
<pre><span class="lnum">  12:  </span>&nbsp;</pre>
<pre><span class="lnum">  13:  </span><span class="kwrd">private</span> <span class="kwrd">void</span> SearchForDesc(SiteMapNode node,<span class="kwrd">string</span> title)</pre>
<pre><span class="lnum">  14:  </span>{</pre>
<pre><span class="lnum">  15:  </span><span class="kwrd">if</span> (node.Title == title)</pre>
<pre><span class="lnum">  16:  </span>{</pre>
<pre><span class="lnum">  17:  </span>menuDescription = node.Description;</pre>
<pre><span class="lnum">  18:  </span><span class="kwrd">return</span>;</pre>
<pre><span class="lnum">  19:  </span>}</pre>
<pre><span class="lnum">  20:  </span><span class="kwrd">else</span></pre>
<pre><span class="lnum">  21:  </span>{</pre>
<pre><span class="lnum">  22:  </span><span class="kwrd">foreach</span> (SiteMapNode childnode <span class="kwrd">in</span> node.ChildNodes)</pre>
<pre><span class="lnum">  23:  </span>{</pre>
<pre><span class="lnum">  24:  </span><span class="rem">//search within childnodes</span></pre>
<pre><span class="lnum">  25:  </span>SearchForDesc(childnode, title);</pre>
<pre><span class="lnum">  26:  </span>}</pre>
<pre><span class="lnum">  27:  </span>}</pre>
<pre><span class="lnum">  28:  </span>}</pre>
</div>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>&nbsp;</p>
<p>And we can use the <a href="http://msdn2.microsoft.com/en-us/library/5t12h3y4.aspx" target="_blank">StaticItemTemplate</a> and the <a href="http://msdn2.microsoft.com/en-us/library/2b7s9547.aspx" target="_blank">DynamicItemTemplate</a> to Display this information and use the <strong><em>GetDescriptionByTitle()</em></strong> method inside the templates as given below:</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">asp:Menu</span> <span class="attr">ID</span><span class="kwrd">="Menu1"</span> <span class="attr">runat</span><span class="kwrd">="server"</span> <span class="attr">Height</span><span class="kwrd">="24px"</span>
<span class="attr">Width</span><span class="kwrd">="109px"</span> <span class="attr">DataSourceID</span><span class="kwrd">="SiteMapDS1"</span> <span class="attr">StaticDisplayLevels</span><span class="kwrd">="2"</span>
<span class="attr">StaticSubMenuIndent</span><span class="kwrd">="0px"</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">StaticItemTemplate</span><span class="kwrd">&gt;</span>    <span class="asp">&lt;%</span># Eval(<span class="str">"Text"</span>) <span class="asp">%&gt;</span> <span class="kwrd">&lt;</span><span class="html">br</span> <span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;</span><span class="html">small</span><span class="kwrd">&gt;</span>
<span class="asp">&lt;%</span># GetDescriptionByTitle(((MenuItem)Container.DataItem).Text) <span class="asp">%&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">small</span><span class="kwrd">&gt;&lt;/</span><span class="html">StaticItemTemplate</span><span class="kwrd">&gt;&lt;</span><span class="html">DynamicItemTemplate</span><span class="kwrd">&gt;</span>
<span class="asp">&lt;%</span># Eval(<span class="str">"Text"</span>) <span class="asp">%&gt;</span> <span class="kwrd">&lt;</span><span class="html">br</span> <span class="kwrd">/&gt;</span>   <span class="kwrd">&lt;</span><span class="html">small</span><span class="kwrd">&gt;</span>
<span class="asp">&lt;%</span># GetDescriptionByTitle(((MenuItem)Container.DataItem).Text) <span class="asp">%&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">small</span><span class="kwrd">&gt;&lt;/</span><span class="html">DynamicItemTemplate</span><span class="kwrd">&gt;&lt;/</span><span class="html">asp:Menu</span><span class="kwrd">&gt;</span></pre>
<pre class="csharpcode"><span class="kwrd"></span>&nbsp;</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>And here is the output:</p>
<p><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="176" alt="menusample" src="http://www.aneef.net/wp-content/uploads/2008/02/menusample.jpg" width="244" border="0"></p>
<p>Hope it helps!.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2008/02/13/show-site-map-description-on-aspnet-20-menu-control/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Windows Services Self Installation</title>
		<link>http://www.aneef.net/2007/12/26/windows-services-self-installation/</link>
		<comments>http://www.aneef.net/2007/12/26/windows-services-self-installation/#comments</comments>
		<pubDate>Wed, 26 Dec 2007 07:28:22 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
		
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.aneef.net/2007/12/26/windows-services-self-installation/</guid>
		<description><![CDATA[W. Kevin Hazzard had blogged a good post about how to make windows services to install them selves without using installutil.exe command which comes with the .NET framework. you can read the full article here.
]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="http://www.gotnet.biz/Default.aspx">W. Kevin Hazzard</a> had blogged a good post about how to make windows services to install them selves without using <strong>installutil.exe</strong> command which comes with the .NET framework. you can read the full article <a target="_blank" href="http://www.gotnet.biz/WindowsServiceSelfInstaller.ashx">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2007/12/26/windows-services-self-installation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SQL Server 2008 Table Valued Parameters</title>
		<link>http://www.aneef.net/2007/12/23/sql-server-2008-table-valued-parameters/</link>
		<comments>http://www.aneef.net/2007/12/23/sql-server-2008-table-valued-parameters/#comments</comments>
		<pubDate>Sun, 23 Dec 2007 15:36:13 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
		
		<category><![CDATA[ADO.net]]></category>

		<category><![CDATA[SQL]]></category>

		<category><![CDATA[c#]]></category>

		<category><![CDATA[visual studio 2008]]></category>

		<guid isPermaLink="false">http://www.aneef.net/2007/12/23/sql-server-2008-table-valued-parameters/</guid>
		<description><![CDATA[Last two weeks I have been working on developing bulk data manipulations. And even before that I always wondered “What&#8217;s the best way to pass an array of values into a SQL Server stored procedure.” One option I found was OPENXML, which I blogged here.

 

And I was trying out visual studio 2008 and SQL [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal"><span>Last two weeks I have been working on developing bulk data manipulations. And even before that I always wondered “</span>What&#8217;s the best way to pass an array of values into a SQL Server stored procedure.” One option I found was <a href="http://www.aneef.net/2007/12/18/adonet-openxml-to-perform-bulk-database-operations/">OPENXML</a>, which I blogged <a href="http://www.aneef.net/2007/12/18/adonet-openxml-to-perform-bulk-database-operations/">here</a>.</p>
<p><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="ProgId" content="Word.Document" /><meta name="Generator" content="Microsoft Word 12" /><meta name="Originator" content="Microsoft Word 12" /></p>
<p><center> <!--adsense#largebox--></br></center></p>
<p class="MsoNormal">
<p>And I was trying out visual studio 2008 and SQL server 2008 these days. And last night I found out that SQL server now support Tabled valued Parameters which allow us to send data tables as parameters to stored procedures. It still uses the same ADO.Net API.</p>
<p class="MsoNormal">Now I’m going to show how it works. For this I’m using the same scenario which I used in my <a href="http://www.aneef.net/2007/12/18/adonet-openxml-to-perform-bulk-database-operations/">previous post</a> (reading contents of a folder and saving their information). here i have used <a href="http://www.microsoft.com/sql/2008/default.mspx" target="_blank">sql server 2008 november ctp</a> and <a href="http://www.microsoft.com/express/vcsharp/Default.aspx">visual  c# 2008 express edition</a>.</p>
<p class="MsoNormal"> First create the table given below:</p>
<blockquote>
<h5><em><span style="font-family: 'Cambria','serif'; color: blue">CREATE TABLE</span></em><em><span style="font-family: 'Cambria','serif'"> FileDetails(<br />
FileName varchar(50) </span></em><em><span style="font-family: 'Cambria','serif'; color: blue">PRIMARY KEY</span></em><em><span style="font-family: 'Cambria','serif'">,<br />
CreatedDate varchar(50) ,<br />
Size </span></em><em><span style="font-family: 'Cambria','serif'; color: blue">decimal</span></em><em><span style="font-family: 'Cambria','serif'">(18, 0) )</span></em></h5>
</blockquote>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="ProgId" content="Word.Document" /><meta name="Generator" content="Microsoft Word 12" /><meta name="Originator" content="Microsoft Word 12" /></p>
<p><!--[if gte mso 9]><xml>  <w:WordDocument>   <w:View>Normal</w:View>   <w:Zoom>0</w:Zoom>   <w:TrackMoves/>   <w:TrackFormatting/>   <w:PunctuationKerning/>   <w:ValidateAgainstSchemas/>   <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>   <w:IgnoreMixedContent>false</w:IgnoreMixedContent>   <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>   <w:DoNotPromoteQF/>   <w:LidThemeOther>EN-US</w:LidThemeOther>   <w:LidThemeAsian>X-NONE</w:LidThemeAsian>   <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>   <w:Compatibility>    <w:BreakWrappedTables/>    <w:SnapToGridInCell/>    <w:WrapTextWithPunct/>    <w:UseAsianBreakRules/>    <w:DontGrowAutofit/>    <w:SplitPgBreakAndParaMark/>    <w:DontVertAlignCellWithSp/>    <w:DontBreakConstrainedForcedTables/>    <w:DontVertAlignInTxbx/>    <w:Word11KerningPairs/>    <w:CachedColBalance/>   </w:Compatibility>   <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>   <m:mathPr>    <m:mathFont m:val="Cambria Math"/>    <m:brkBin m:val="before"/>    <m:brkBinSub m:val="--"/>    <m:smallFrac m:val="off"/>    <m:dispDef/>    <m:lMargin m:val="0"/>    <m:rMargin m:val="0"/>    <m:defJc m:val="centerGroup"/>    <m:wrapIndent m:val="1440"/>    <m:intLim m:val="subSup"/>    <m:naryLim m:val="undOvr"/>   </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml>  <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"   DefSemiHidden="true" DefQFormat="false" DefPriority="99"   LatentStyleCount="267">   <w:LsdException Locked="false" Priority="0" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Normal"/>   <w:LsdException Locked="false" Priority="9" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>   <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>   <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>   <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>   <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>   <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>   <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>   <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>   <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>   <w:LsdException Locked="false" Priority="39" Name="toc 1"/>   <w:LsdException Locked="false" Priority="39" Name="toc 2"/>   <w:LsdException Locked="false" Priority="39" Name="toc 3"/>   <w:LsdException Locked="false" Priority="39" Name="toc 4"/>   <w:LsdException Locked="false" Priority="39" Name="toc 5"/>   <w:LsdException Locked="false" Priority="39" Name="toc 6"/>   <w:LsdException Locked="false" Priority="39" Name="toc 7"/>   <w:LsdException Locked="false" Priority="39" Name="toc 8"/>   <w:LsdException Locked="false" Priority="39" Name="toc 9"/>   <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>   <w:LsdException Locked="false" Priority="10" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Title"/>   <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>   <w:LsdException Locked="false" Priority="11" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>   <w:LsdException Locked="false" Priority="22" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Strong"/>   <w:LsdException Locked="false" Priority="20" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>   <w:LsdException Locked="false" Priority="59" SemiHidden="false"    UnhideWhenUsed="false" Name="Table Grid"/>   <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>   <w:LsdException Locked="false" Priority="1" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 1"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 1"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 1"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>   <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>   <w:LsdException Locked="false" Priority="34" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>   <w:LsdException Locked="false" Priority="29" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Quote"/>   <w:LsdException Locked="false" Priority="30" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 1"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 1"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 2"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 2"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 2"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 2"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 2"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 3"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 3"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 3"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 3"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 3"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 4"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 4"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 4"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 4"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 4"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 5"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 5"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 5"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 5"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 5"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 6"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 6"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 6"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 6"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 6"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>   <w:LsdException Locked="false" Priority="19" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>   <w:LsdException Locked="false" Priority="21" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>   <w:LsdException Locked="false" Priority="31" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>   <w:LsdException Locked="false" Priority="32" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>   <w:LsdException Locked="false" Priority="33" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>   <w:LsdException Locked="false" Priority="37" Name="Bibliography"/>   <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>  </w:LatentStyles> </xml><![endif]--></p>
<style> <!--  /* Font Definitions */  @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:1; 	mso-generic-font-family:roman; 	mso-font-format:other; 	mso-font-pitch:variable; 	mso-font-signature:0 0 0 0 0 0;} @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1073750139 0 0 159 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:0in; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} .MsoPapDefault 	{mso-style-type:export-only; 	margin-bottom:10.0pt; 	line-height:115%;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.0in 1.0in 1.0in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --> </style>
<p><!--[if gte mso 10]></p>
<style>  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin-top:0in; 	mso-para-margin-right:0in; 	mso-para-margin-bottom:10.0pt; 	mso-para-margin-left:0in; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin;} </style>
<p> <![endif]--></p>
<p class="MsoNormal">Then, we should declare a new Table User Defined Type in the database:</p>
<blockquote>
<p class="MsoNormal">create type FileDetailsType as table<br />
(<br />
<span> </span><span>   </span>FileName<span>        </span>varchar(50),<br />
<span>    </span>CreatedDate<span>        </span>varchar(50),<br />
<span>    </span>Size<span>       </span>decimal(18,0)<br />
)</p></blockquote>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="ProgId" content="Word.Document" /><meta name="Generator" content="Microsoft Word 12" /><meta name="Originator" content="Microsoft Word 12" /></p>
<link href="file:///C:%5CUsers%5CAzmil%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml" rel="File-List" />
<link href="file:///C:%5CUsers%5CAzmil%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx" rel="themeData" />
<link href="file:///C:%5CUsers%5CAzmil%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml" rel="colorSchemeMapping" /><!--[if gte mso 9]><xml>  <w:WordDocument>   <w:View>Normal</w:View>   <w:Zoom>0</w:Zoom>   <w:TrackMoves/>   <w:TrackFormatting/>   <w:PunctuationKerning/>   <w:ValidateAgainstSchemas/>   <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>   <w:IgnoreMixedContent>false</w:IgnoreMixedContent>   <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>   <w:DoNotPromoteQF/>   <w:LidThemeOther>EN-US</w:LidThemeOther>   <w:LidThemeAsian>X-NONE</w:LidThemeAsian>   <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>   <w:Compatibility>    <w:BreakWrappedTables/>    <w:SnapToGridInCell/>    <w:WrapTextWithPunct/>    <w:UseAsianBreakRules/>    <w:DontGrowAutofit/>    <w:SplitPgBreakAndParaMark/>    <w:DontVertAlignCellWithSp/>    <w:DontBreakConstrainedForcedTables/>    <w:DontVertAlignInTxbx/>    <w:Word11KerningPairs/>    <w:CachedColBalance/>   </w:Compatibility>   <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>   <m:mathPr>    <m:mathFont m:val="Cambria Math"/>    <m:brkBin m:val="before"/>    <m:brkBinSub m:val="--"/>    <m:smallFrac m:val="off"/>    <m:dispDef/>    <m:lMargin m:val="0"/>    <m:rMargin m:val="0"/>    <m:defJc m:val="centerGroup"/>    <m:wrapIndent m:val="1440"/>    <m:intLim m:val="subSup"/>    <m:naryLim m:val="undOvr"/>   </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml>  <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"   DefSemiHidden="true" DefQFormat="false" DefPriority="99"   LatentStyleCount="267">   <w:LsdException Locked="false" Priority="0" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Normal"/>   <w:LsdException Locked="false" Priority="9" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>   <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>   <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>   <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>   <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>   <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>   <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>   <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>   <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>   <w:LsdException Locked="false" Priority="39" Name="toc 1"/>   <w:LsdException Locked="false" Priority="39" Name="toc 2"/>   <w:LsdException Locked="false" Priority="39" Name="toc 3"/>   <w:LsdException Locked="false" Priority="39" Name="toc 4"/>   <w:LsdException Locked="false" Priority="39" Name="toc 5"/>   <w:LsdException Locked="false" Priority="39" Name="toc 6"/>   <w:LsdException Locked="false" Priority="39" Name="toc 7"/>   <w:LsdException Locked="false" Priority="39" Name="toc 8"/>   <w:LsdException Locked="false" Priority="39" Name="toc 9"/>   <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>   <w:LsdException Locked="false" Priority="10" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Title"/>   <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>   <w:LsdException Locked="false" Priority="11" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>   <w:LsdException Locked="false" Priority="22" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Strong"/>   <w:LsdException Locked="false" Priority="20" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>   <w:LsdException Locked="false" Priority="59" SemiHidden="false"    UnhideWhenUsed="false" Name="Table Grid"/>   <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>   <w:LsdException Locked="false" Priority="1" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 1"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 1"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 1"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>   <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>   <w:LsdException Locked="false" Priority="34" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>   <w:LsdException Locked="false" Priority="29" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Quote"/>   <w:LsdException Locked="false" Priority="30" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 1"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 1"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 2"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 2"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 2"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 2"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 2"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 3"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 3"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 3"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 3"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 3"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 4"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 4"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 4"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 4"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 4"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 5"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 5"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 5"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 5"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 5"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 6"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 6"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 6"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 6"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 6"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>   <w:LsdException Locked="false" Priority="19" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>   <w:LsdException Locked="false" Priority="21" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>   <w:LsdException Locked="false" Priority="31" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>   <w:LsdException Locked="false" Priority="32" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>   <w:LsdException Locked="false" Priority="33" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>   <w:LsdException Locked="false" Priority="37" Name="Bibliography"/>   <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>  </w:LatentStyles> </xml><![endif]--><br />
<style><!--  /* Font Definitions */  @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:1; 	mso-generic-font-family:roman; 	mso-font-format:other; 	mso-font-pitch:variable; 	mso-font-signature:0 0 0 0 0 0;} @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1073750139 0 0 159 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:0in; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} .MsoPapDefault 	{mso-style-type:export-only; 	margin-bottom:10.0pt; 	line-height:115%;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 27.0pt 1.0in 1.0in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --> </style>
<p><!--[if gte mso 10]></p>
<style>  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin-top:0in; 	mso-para-margin-right:0in; 	mso-para-margin-bottom:10.0pt; 	mso-para-margin-left:0in; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin;} </style>
<p> <![endif]--></p>
<p class="MsoNormal">Then create a stored procedure that gets a parameter of the above type, and inserts many rows in a single command.</p>
<blockquote>
<p class="MsoNormal">create procedure InsertFileDetails<br />
(<br />
<span>  </span><span>  </span>@FileDetails FileDetailsType readonly<br />
)<br />
as</p>
<p class="MsoNormal"><span>    </span>insert<br />
<span>    </span>into<span>   </span>FileDetails (FileName, CreatedDate, Size)<br />
<span>    </span>select FileName, CreatedDate, Size<br />
<span>    </span>from<span>   </span>@FileDetails;</p></blockquote>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Then to execute this procedure, we can create a data table and add the rows in to it. And then pass this data table as parameter to the database.</p>
<blockquote>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'; color: blue">private</span><span style="font-size: 10pt; font-family: 'Courier New'"> <span style="color: blue">static</span> <span style="color: blue">void</span> SaveFileDetail(<span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">FileInfo</span>&gt; info)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span> </span>{<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>  </span><span style="color: #2b91af">Console</span>.WriteLine(<span style="color: #a31515">&#8220;**********updating with tablevalued parameters****&#8221;</span>);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>  </span><span style="color: #2b91af">DataTable</span> dt = preparedatatable();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>  </span><span style="color: blue">foreach</span> (<span style="color: #2b91af">FileInfo</span> file <span style="color: blue">in</span> info)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>     </span>{<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>       </span><span style="color: #2b91af">DataRow</span> dr = dt.NewRow();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>       </span><span></span>dr[0] = file.Name;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>       </span>dr[1] = file.CreationTime.ToShortDateString();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>       </span>dr[2] = (<span style="color: blue">decimal</span>)file.Length;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>       </span>dt.Rows.Add(dr);<o:p></o:p><span></span></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>     </span>}<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>            </span><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span> </span><span style="color: blue">using</span> (<span style="color: #2b91af">SqlConnection</span> conn = <span style="color: blue">new</span> <span style="color: #2b91af">SqlConnection</span>(<span style="color: #a31515">&#8220;your connection string&#8221;</span>))<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>    </span>{<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>       </span><span style="color: #2b91af">SqlCommand</span> cmd = conn.CreateCommand();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>       </span>cmd.CommandType = System.Data.<span style="color: #2b91af">CommandType</span>.StoredProcedure;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>       </span>cmd.CommandText = <span style="color: #a31515">&#8220;dbo.InsertFileDetails&#8221;</span>;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>       </span><span style="color: #2b91af">SqlParameter</span> param = cmd.Parameters.AddWithValue(<span style="color: #a31515">&#8220;@FileDetails&#8221;</span>, dt);<span>                               </span><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>       </span>conn.Open();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>       </span>cmd.ExecuteNonQuery();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'"><span>       </span><span style="color: #2b91af">Console</span>.WriteLine(<span style="color: #a31515">&#8220;Completed Updating the database&#8221;</span>);<o:p></o:p></span><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New'"><span></span></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New'"><span>     </span>}<o:p></o:p></span></p>
</blockquote>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New'"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New'">Now that’s cool isn’t it????</span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><strong><a href="http://www.aneef.net/wp-content/uploads/2007/12/tblvalueparam.zip" title="source code" target="_blank">Download the code </a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2007/12/23/sql-server-2008-table-valued-parameters/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ADO.Net &#38; OPENXML to Perform Bulk Database Operations</title>
		<link>http://www.aneef.net/2007/12/18/adonet-openxml-to-perform-bulk-database-operations/</link>
		<comments>http://www.aneef.net/2007/12/18/adonet-openxml-to-perform-bulk-database-operations/#comments</comments>
		<pubDate>Tue, 18 Dec 2007 05:36:37 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
		
		<category><![CDATA[ADO.net]]></category>

		<category><![CDATA[SQL]]></category>

		<category><![CDATA[Visual Studio]]></category>

		<category><![CDATA[c#]]></category>

		<category><![CDATA[.net]]></category>

		<category><![CDATA[Aneef]]></category>

		<category><![CDATA[BULK Data manipulation]]></category>

		<guid isPermaLink="false">http://www.aneef.net/?p=7</guid>
		<description><![CDATA[Last week at my work I had to write a tool to process few hundreds of thousand email files and insert their details to the MS SQL Server 2005 database. Doing it in traditional way might require much connectivity to the database and will consume many resources. I was wondering what if I could insert [...]]]></description>
			<content:encoded><![CDATA[<p>Last week at my work I had to write a tool to process few hundreds of thousand email files and insert their details to the MS SQL Server 2005 database. Doing it in traditional way might require much connectivity to the database and will consume many resources. I was wondering what if I could insert those whole hundreds thousands of data at once to the db which will be much more efficient. I started googgling and I found <a href="http://msdn2.microsoft.com/en-us/library/aa276847.aspx">OPENXML</a>. This is not a whole new technology but I didn’t know about this before (strange!!).</p>
<p>And few more minutes of research I found out how to perform bulk operations against the databases using OPENXML and stored procedures.</p>
<p><strong>What is OPENXML?</strong></p>
<p>OPENXML is a function added to SQL Server 2000 that provides a row set view over an XML document. Since a row set is simply a set of rows that contain columns of data, OPENXML is the function that allows an XML document to be treated in the familiar relational database format. It allows for the passing of an XML document to a T-SQL stored procedure for updating the data.</p>
<p><strong>OPENXML- Summery</strong></p>
<ul>
<li>It extends the SQL Language</li>
<li>It is used within T-SQL Stored Procedures
<ul>
<li>XML Document passed as parameter</li>
</ul>
</li>
<li>It uses row and column selectors utilizing XPath</li>
<li>It supports the following:
<ul>
<li>Attribute and element-centric mappings.</li>
<li>Edge table row set.</li>
<li>XML annotation/overflow column.</li>
<li>Hierarchy support.</li>
</ul>
</li>
</ul>
<p><strong>OPENXML and ADO.Net</strong></p>
<p>This code block explains the usage of OPENXML to insert bulk data to database. It simulates the actual process I wanted ( processing .eml files) by reading files in a folder and saving their names, created date and size in bytes.</p>
<ol>
<li>First create the table below:<br />
<h5></h5>
<h6></h6>
<blockquote>
<h5><em><font color="#0000ff">CREATE TABLE</font> FileDetails(</em></h5>
<h5><em>FileName varchar(50) <font color="#0000ff">PRIMARY KEY</font>,</em></h5>
<h5><em>CreatedDate varchar(50) ,</em></h5>
<h5><em>Size <font color="#0000ff">decimal</font>(18, 0) )</em></h5>
</blockquote>
</li>
<li>And then create the stored procedure below:<br />
<blockquote>
<h5><em><font color="#0000ff"><em><font color="#0000ff"><em><font color="#0000ff">CREATE PROC</font> sp_bulkinsert @xmldata varchar(max)</em></font></em></font></em></h5>
<h5><font color="#0000ff"><em>AS</em></font></h5>
<h5><em><font color="#0000ff">DECLARE</font> @hDoc int</em></h5>
<h5><em><font color="#0000ff">exec</font> sp_xml_preparedocument @hDoc OUTPUT,@xmldata</em></h5>
<h5><em>&#8211;inserting data</em></h5>
<h5><em><font color="#0000ff">Insert</font> Into FileDetails </em></h5>
<h5><em><font color="#0000ff">SELECT</font> FileName, CreatedDate, Size</em></h5>
<h5><em><font color="#0000ff">FROM</font> OPENXML (@hdoc, &#8216;/ds/fileDetails&#8217;,2)</em></h5>
<h5><em><font color="#0000ff">WITH</font> (FileName varchar(50), CreatedDate Datetime, Size decimal) XMLFileDetails</em></h5>
<h5><em><font color="#0000ff">Where</font> XMLFileDetails.FileName Not IN (Select FileName from FileDetails)</em></h5>
<h5><em><font color="#0000ff">EXEC</font> sp_xml_removedocument @hDoc</em></h5>
<h5><font color="#0000ff"><em>GO</em></font></h5>
</blockquote>
</li>
<li>The below sample code snippet shows how to call this stored procedure to insert bulk data to database at once.</li>
</ol>
<ol>We can retrieve the file details using FileInfo() objects and create a Dataset of the file details and then we can convert this Dataset to xml using <a href="http://msdn2.microsoft.com/en-us/library/system.data.dataset.writexml.aspx">WriteXml()</a> Method of the Dataset.</ol>
<blockquote><p><em>private static string preparexml(DataSet ds)</em></p>
<p><em>{</em></p>
<p><em>StringBuilder sb = new StringBuilder();</em></p>
<p><em>StringWriter sw = new StringWriter(sb);</em></p>
<p><em>ds.WriteXml(sw, XmlWriteMode.WriteSchema);</em></p>
<p><em>return sb.ToString();</em></p>
<p><em>}</em></p></blockquote>
<p>This xml representation of the data can be passed as the parameter to the stored procedure as given below :</p>
<blockquote><p><code><em>private static void bulkInsert(string xml)</em> </code></p>
<p><em>{</em></p>
<p><em>try{</em></p>
<p><em>SqlConnection con = creatCon();</em></p>
<p><em>con.Open();</em></p>
<p><em>SqlCommand cmd = new SqlCommand(&#8221;sp_bulkinsert&#8221;, con);</em></p>
<p><em>cmd.CommandType = CommandType.StoredProcedure;</em></p>
<p><em>cmd.Parameters.Add(new SqlParameter(&#8221;@xmldata&#8221;,SqlDbType.VarChar));</em></p>
<p><em>cmd.Parameters["@xmldata"].Value=xml;</em></p>
<p><em>cmd.ExecuteNonQuery();</em></p>
<p><em>Console.WriteLine(&#8221;Completed inserting file informations to database&#8221;);</em></p>
<p><em>con.Close();</em></p>
<p><em>}</em></p>
<p><em>catch(Exception ex)</em></p>
<p><em>{</em></p>
<p><em>Console.WriteLine(ex.Message);</em></p>
<p><em>}</em></p>
<p><em>}</em></p></blockquote>
<p>That’s all simple isn’t it? You can see the performance of this method by writing another code to insert the same fields using the traditional 1 at a time way. Which surprisingly will show a huge difference in performance and time.</p>
<p>You can use the same way to update, delete records in bulk.</p>
<p>The complete code can be downloaded and tested in the below link :</p>
<p><a href="http://www.aneef.net/wp-content/uploads/2007/12/bulkoperations.zip">Complete Source Code</a></p>
<p><!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2007/12/18/adonet-openxml-to-perform-bulk-database-operations/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
