<?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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rasik Jain&#039;s Blog</title>
	<atom:link href="http://www.rasikjain.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rasikjain.com</link>
	<description>Technology Musings........</description>
	<lastBuildDate>Tue, 13 Apr 2010 14:02:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Visual Studio 2010 finally released</title>
		<link>http://www.rasikjain.com/2010/04/13/visual-studio-2010-finally-released/</link>
		<comments>http://www.rasikjain.com/2010/04/13/visual-studio-2010-finally-released/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 13:58:37 +0000</pubDate>
		<dc:creator>Rasik Jain</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>

		<guid isPermaLink="false">http://www.rasikjain.com/?p=93</guid>
		<description><![CDATA[The Visual Studio 2010 IDE has been redesigned which, according to Microsoft, clears the UI organization and &#8220;reduces clutter and complexity.&#8221; The new IDE better supports multiple document windows and floating tool windows,[70] while offering better multi-monitor support. The IDE shell has been rewritten using the Windows Presentation Foundation (WPF),[71] whereas the internals have been [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.rasikjain.com%2F2010%2F04%2F13%2Fvisual-studio-2010-finally-released%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.rasikjain.com%2F2010%2F04%2F13%2Fvisual-studio-2010-finally-released%2F" height="61" width="51" /></a></div><p>The <strong>Visual Studio 2010 IDE</strong> has been redesigned which, according to Microsoft, clears the <strong>UI organization</strong> and &#8220;reduces clutter and complexity.&#8221; The new IDE better supports multiple document windows and floating tool windows,[70] while offering better multi-monitor support. The IDE shell has been rewritten using the <strong>Windows Presentation Foundation</strong> (WPF),[71] whereas the internals have been redesigned using <strong>Managed Extensibility Framework</strong> (MEF) that offers more extensibility points than previous versions of the IDE that enabled add-ins to modify the behavior of the IDE.</p>
<p>Visual Studio 2010 comes with <strong>.NET Framework 4</strong> and includes <strong>F#</strong>, a functional programming language originally developed at Microsoft Research. </p>
<p>Please find more details at <a href="http://www.microsoft.com/visualstudio/en-us/products"><strong>Microsoft Visual Studio 2010</strong></a> page.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.rasikjain.com%2F2010%2F04%2F13%2Fvisual-studio-2010-finally-released%2F&amp;linkname=Visual%20Studio%202010%20finally%20released"><img src="http://www.rasikjain.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.rasikjain.com/2010/04/13/visual-studio-2010-finally-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Convert XML to CSV using LINQ to XML</title>
		<link>http://www.rasikjain.com/2009/11/06/convert-xml-to-csv-using-linq-to-xml/</link>
		<comments>http://www.rasikjain.com/2009/11/06/convert-xml-to-csv-using-linq-to-xml/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 15:25:00 +0000</pubDate>
		<dc:creator>Rasik Jain</dc:creator>
				<category><![CDATA[C# (C-Sharp)]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Linq to XML]]></category>
		<category><![CDATA[XmltoCSV]]></category>

		<guid isPermaLink="false">http://www.rasikjain.com/2009/11/06/convert-xml-to-csv-using-linq-to-xml/</guid>
		<description><![CDATA[This post will show you how to convert an XML file to CSV using Linq to XML and Anonymous types of C# 3.0. LINQ to XML is an lightweight in-memory XML programming API by which a user can manipulate the XML data such as

Reading from XML file
Writing to XML file
Add or Remove XML elements from [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F11%2F06%2Fconvert-xml-to-csv-using-linq-to-xml%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F11%2F06%2Fconvert-xml-to-csv-using-linq-to-xml%2F" height="61" width="51" /></a></div><p>This post will show you how to convert an XML file to CSV using <strong><a href="http://msdn.microsoft.com/en-us/library/bb387098.aspx" target="_blank">Linq to XML</a></strong> and <strong><a href="http://msdn.microsoft.com/en-us/library/bb397696.aspx" target="_blank">Anonymous types</a></strong> of <a href="http://msdn.microsoft.com/en-us/library/bb308966.aspx" target="_blank"><strong>C# 3.0</strong></a>. LINQ to XML is an lightweight in-memory XML programming API by which a user can manipulate the XML data such as</p>
<ul>
<li>Reading from XML file</li>
<li>Writing to XML file</li>
<li>Add or Remove XML elements from XML tree.</li>
</ul>
<p>Now lets dig into the code sample.</p>
<p>Following is the code snippet which helps in converting the <strong>XML file into CSV Format</strong>.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">// Loading from a file, you can also load from a stream</span>
XDocument loaded <span style="color: #008000;">=</span> XDocument.<span style="color: #0000FF;">Load</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">@&quot;C:\Contacts.xml&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// create a writer and open the file</span>
TextWriter tw <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> StreamWriter<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;c:<span style="color: #008080; font-weight: bold;">\\</span>XmltoCSV.txt&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// Query the data and write out a subset of contacts</span>
var contacts <span style="color: #008000;">=</span> from c <span style="color: #0600FF;">in</span> loaded.<span style="color: #0000FF;">Descendants</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;CONTACT&quot;</span><span style="color: #000000;">&#41;</span>
		select <span style="color: #008000;">new</span>
		<span style="color: #000000;">&#123;</span>
			FirstName <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#41;</span>c.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;FIRSTNAME&quot;</span><span style="color: #000000;">&#41;</span>,
			LastName <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#41;</span>c.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;LASTNAME&quot;</span><span style="color: #000000;">&#41;</span>,
			City <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#41;</span>c.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;CITY&quot;</span><span style="color: #000000;">&#41;</span>,
			State <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#41;</span>c.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;STATE&quot;</span><span style="color: #000000;">&#41;</span>,
			Country <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#41;</span>c.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;COUNTRY&quot;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#125;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>var contact <span style="color: #0600FF;">in</span> contacts<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #FF0000;">string</span> s <span style="color: #008000;">=</span> contact.<span style="color: #0000FF;">FirstName</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;,&quot;</span> <span style="color: #008000;">+</span>
				contact.<span style="color: #0000FF;">LastName</span><span style="color: #008000;">+</span> <span style="color: #666666;">&quot;,&quot;</span> <span style="color: #008000;">+</span>
				contact.<span style="color: #0000FF;">City</span><span style="color: #008000;">+</span> <span style="color: #666666;">&quot;,&quot;</span> <span style="color: #008000;">+</span>
				contact.<span style="color: #0000FF;">State</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;,&quot;</span> <span style="color: #008000;">+</span>
				contact.<span style="color: #0000FF;">Country</span><span style="color: #008000;">;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">// write a line of text to the file</span>
	tw.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>s<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// close the stream</span>
tw.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p><strong>INPUT (XML File)</strong>: We will use the XML file to read the data.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">'1.0'</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">'utf-8'</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CONTACTS<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CONTACT<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;FIRSTNAME<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>John<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/FIRSTNAME<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;LASTNAME<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Doe<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/LASTNAME<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>	
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CITY<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Miami<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CITY<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;STATE<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Florida<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/STATE<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;COUNTRY<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>USA<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/COUNTRY<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CONTACT<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CONTACT<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;FIRSTNAME<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Shane<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/FIRSTNAME<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;LASTNAME<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Warne<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/LASTNAME<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>	
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CITY<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Sydney<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CITY<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;STATE<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>New South Wales<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/STATE<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;COUNTRY<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Australia<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/COUNTRY<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CONTACT<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CONTACT<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;FIRSTNAME<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Adam<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/FIRSTNAME<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;LASTNAME<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Smith<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/LASTNAME<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>	
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CITY<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>London<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CITY<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;STATE<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>London<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/STATE<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;COUNTRY<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>UK<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/COUNTRY<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CONTACT<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CONTACTS<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><strong>OUTPUT (CSV file):</strong> Comma Separated File (CSV) will be generated as the output.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">John,Doe,Miami,Florida,USA
Shane,Warne,Sydney,New South Wales,Australia
Adam,Smith,London,London,UK</pre></div></div>

<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F11%2F06%2Fconvert-xml-to-csv-using-linq-to-xml%2F&amp;linkname=Convert%20XML%20to%20CSV%20using%20LINQ%20to%20XML"><img src="http://www.rasikjain.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.rasikjain.com/2009/11/06/convert-xml-to-csv-using-linq-to-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server 2008 &#8211; Transparent Data Encryption (TDE)</title>
		<link>http://www.rasikjain.com/2009/08/31/sql-server-2008-transparent-data-encryption-tde/</link>
		<comments>http://www.rasikjain.com/2009/08/31/sql-server-2008-transparent-data-encryption-tde/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 17:45:11 +0000</pubDate>
		<dc:creator>Rasik Jain</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Encryption]]></category>

		<guid isPermaLink="false">http://www.rasikjain.com/?p=74</guid>
		<description><![CDATA[With every new version of SQL server, Microsoft is adding new and exciting features for database encryption. In SQL Server 2008, Microsoft has introduced a new encryption technique called Transparent Data Encryption (TDE). With TDE, Encryption is performed on the database with real time I/O operations. The performance of encryption and decryption is better when [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F08%2F31%2Fsql-server-2008-transparent-data-encryption-tde%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F08%2F31%2Fsql-server-2008-transparent-data-encryption-tde%2F" height="61" width="51" /></a></div><div>With every new version of SQL server, Microsoft is adding new and exciting features for database encryption. In SQL Server 2008, Microsoft has introduced a new encryption technique called <strong>Transparent Data Encryption (TDE)</strong>. With TDE, Encryption is performed on the database with real time I/O operations. The performance of <strong>encryption</strong> and <strong>decryption</strong> is better when compared to SQL Server 2005.</p>
<p><strong>Transparent Data Encryption (TDE)</strong> uses database encryption symmetric key (DEK) for the purpose of encryption and decryption. DEK is stored in master databased secured by <strong>certificate</strong> or <strong>asymmetric key</strong>. TDE provides the ability to encrypt the data at root levels meaning data and log files. This way users can encrypt the data without modifying the design of existing applications. TDE does not affect the size of the database. Size of the database remains same with or without TDE encryption. for TDE enabled database, backup files are also encrypted using DEK. So, during the restore process, certificate protecting database must be available. Care must be taken to backup server certificates on regular basis.</p>
<p>Following are the important steps in configuring the <strong>Transparent Data Encryption (TDE).</strong></p>
<ol>
<li>Create a <strong>Master Key</strong></li>
<li>Generate a <strong>certificate</strong>protected by master key.</li>
<li>Create a <strong>database encryption key (DEK)</strong> protected by certificate.</li>
<li>Enable the <strong>TDE encryption</strong> for selected database.</li>
</ol>
<p>Here is an example for enabling the encryption on database <strong>Northwind</strong> using a certificate named <strong>MySQLCertificate</strong>.</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #0000FF;">USE</span> Master;
GO
&nbsp;
<span style="color: #008080;">--Create Master Key</span>
<span style="color: #0000FF;">CREATE</span> MASTER <span style="color: #0000FF;">KEY</span> ENCRYPTION <span style="color: #0000FF;">BY</span> PASSW<span style="color: #808080;">OR</span>D <span style="color: #808080;">=</span> <span style="color: #FF0000;">'Password1'</span>;
GO
&nbsp;
<span style="color: #008080;">--Create Certificate</span>
<span style="color: #0000FF;">CREATE</span> CERTIFICATE MySQLServerCertificate <span style="color: #0000FF;">WITH</span> SUBJECT <span style="color: #808080;">=</span> <span style="color: #FF0000;">'My SQL Server Certificate'</span>
GO
&nbsp;
<span style="color: #0000FF;">USE</span> Northwind
GO
&nbsp;
<span style="color: #008080;">--Create Database Encryption Key (DEK)</span>
<span style="color: #0000FF;">CREATE</span> <span style="color: #0000FF;">DATABASE</span> ENCRYPTION <span style="color: #0000FF;">KEY</span>
<span style="color: #0000FF;">WITH</span> ALG<span style="color: #808080;">OR</span>ITHM <span style="color: #808080;">=</span> TRIPLE_DES
ENCRYPTION <span style="color: #0000FF;">BY</span> SERVER CERTIFICATE MySQLServerCertificate
GO
&nbsp;
<span style="color: #008080;">-- Enable the TDE Encryption for the database</span>
<span style="color: #0000FF;">ALTER</span> <span style="color: #0000FF;">DATABASE</span> Northwind
<span style="color: #0000FF;">SET</span> ENCRYPTION <span style="color: #0000FF;">ON</span>
GO</pre></div></div>

</div>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F08%2F31%2Fsql-server-2008-transparent-data-encryption-tde%2F&amp;linkname=SQL%20Server%202008%20%26%238211%3B%20Transparent%20Data%20Encryption%20%28TDE%29"><img src="http://www.rasikjain.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.rasikjain.com/2009/08/31/sql-server-2008-transparent-data-encryption-tde/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Securing Session Cookies or ID&#8217;s over Network</title>
		<link>http://www.rasikjain.com/2009/06/03/securing-session-cookies-or-ids-over-network/</link>
		<comments>http://www.rasikjain.com/2009/06/03/securing-session-cookies-or-ids-over-network/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 21:49:53 +0000</pubDate>
		<dc:creator>Rasik Jain</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://www.rasikjain.com/?p=68</guid>
		<description><![CDATA[Securing the session ID during the transmission over network.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F06%2F03%2Fsecuring-session-cookies-or-ids-over-network%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F06%2F03%2Fsecuring-session-cookies-or-ids-over-network%2F" height="61" width="51" /></a></div><p>Following are some of the security practices for <strong>secure transmission of session cookies </strong>between web server and client.</p>
<ul>
<li>If its a commercial website, then install <strong>SSL</strong> for secure communication.</li>
<li>Generate <strong>unpredictable Random</strong> characters for the sessionID value.</li>
<li><strong>Avoid incremental</strong> or time based session cookie values.</li>
<li>Issue or generate session cookie after <strong>successful authentication</strong> only.</li>
<li>Never generate cookies as <strong>Persistent</strong> cookies on the users hard disk.</li>
<li>Set the &#8220;<strong>SECURE</strong>&#8221; flag for the session cookie which means cookies will be transmitted over SSL only.</li>
<li>Set the <strong>Path </strong>and <strong>Domain </strong>of session cookies.</li>
<li>Never store or pass session information in <strong>URL </strong>and <strong>Hidden </strong>Fields.</li>
</ul>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F06%2F03%2Fsecuring-session-cookies-or-ids-over-network%2F&amp;linkname=Securing%20Session%20Cookies%20or%20ID%26%238217%3Bs%20over%20Network"><img src="http://www.rasikjain.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.rasikjain.com/2009/06/03/securing-session-cookies-or-ids-over-network/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Secure Database against SQL Injection attacks</title>
		<link>http://www.rasikjain.com/2009/05/10/secure-database-against-sql-injection-attacks/</link>
		<comments>http://www.rasikjain.com/2009/05/10/secure-database-against-sql-injection-attacks/#comments</comments>
		<pubDate>Sun, 10 May 2009 04:09:52 +0000</pubDate>
		<dc:creator>Rasik Jain</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.rasikjain.com/?p=54</guid>
		<description><![CDATA[Following are some of the recommendations to protect the application against SQL injection attacks. These recommendations are very generic in nature and independent of database platform so they can be applied to any database such as SQL Server 2000/2005, Oracle, MySQL or DB2
Sanitization Input:Protecting SQL queries by implementing sanitization techniques for all input received from [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F05%2F10%2Fsecure-database-against-sql-injection-attacks%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F05%2F10%2Fsecure-database-against-sql-injection-attacks%2F" height="61" width="51" /></a></div><p>Following are some of the recommendations to protect the application <strong>against SQL injection attacks</strong>. These recommendations are very generic in nature and independent of database platform so they can be applied to any database such as SQL Server 2000/2005, Oracle, MySQL or DB2</p>
<p><strong>Sanitization Input:</strong>Protecting SQL queries by implementing sanitization techniques for all input received from any ASP.NET request object. Check all the input sources such as Request.Cookies, Form Variables, Query String parameters, Request.ServerVariables etc. Sanitization routines will vary based on your DBMS.</p>
<p><strong>Avoid disclosing database error information.</strong> In the event of database errors, make sure you do not disclose detailed error messages to the user. Never display debug or detailed information to the user containing SQL queries.</p>
<p><strong>Check SQL meta-characters </strong>(single-quote(‘), semi-colon(;) or double-dash(&#8211;), or multi-line comments (/* */) etc) and command keywords (Select, Union, Delete, Drop, etc) from the input. Always check and filter these keywords in the input fields. Always perform these checks on server-side. Do not rely on client-side validation alone.</p>
<p><strong>Escape/Quotesafe</strong> the input, such as by replacing all single quotes with two single quotes.</p>
<p><strong>Constrain and sanitize input data</strong>. Check for known good data by validating for type, length, format, and range. Validation should be done on both server side and client side.</p>
<p><strong>Remove unused </strong>extended stored procedures, like xp_cmdshell and xp_grantlogin, and other user-defined functions.</p>
<p><strong>Limit the permissions</strong> granted to the database user account used by the Web application. Most of the cases, only “EXEC” permission is required for stored procs. Remove DBO privileges to the application account.</p>
<p><strong>Avoid Dynamic Queries:</strong> Always use stored procedures to communicate with database. Avoid using dynamic queries or SQL statements embedded in the program code.</p>
<p><strong>Use type-safe SQL parameters</strong> for data access. You can use these parameters with stored procedures or dynamically constructed SQL command strings. Parameter collections such as SqlParameterCollection provide type checking and length validation. If you use a parameters collection, input is treated as a literal value, and SQL Server does not treat it as executable code. An additional benefit of using a parameters collection is that you can enforce type and length checks. Values outside of the range trigger an exception.</p>
<p>Following is a sample <strong>VB.NET routine </strong>which will check for invalid characters in the data input.</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;">&nbsp;
<span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Function</span> TestForSQLInjection<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> psSQL <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>
&nbsp;
	<span style="color: #0600FF;">Dim</span> rexSql <span style="color: #FF8000;">As</span> Regex <span style="color: #008000;">=</span> <span style="color: #FF8000;">New</span> Regex<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;/exec(\s|\+)+(s|x)p\w+/ix&quot;</span><span style="color: #000000;">&#41;</span>
&nbsp;
	<span style="color: #0600FF;">Dim</span> rexSql2 <span style="color: #FF8000;">As</span> Regex <span style="color: #008000;">=</span> <span style="color: #FF8000;">New</span> Regex<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;(\-\-)&quot;</span><span style="color: #000000;">&#41;</span>
&nbsp;
	<span style="color: #0600FF;">If</span> <span style="color: #804040;">Not</span> rexSql.<span style="color: #0000FF;">Match</span><span style="color: #000000;">&#40;</span>psSQL<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Success</span> <span style="color: #804040;">And</span> <span style="color: #804040;">Not</span> rexSql2.<span style="color: #0000FF;">Match</span><span style="color: #000000;">&#40;</span>psSQL<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Success</span> <span style="color: #FF8000;">Then</span>
&nbsp;
		<span style="color: #FF8000;">Return</span> psSQL
&nbsp;
	<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
&nbsp;
<span style="color: #FF8000;">Throw</span> <span style="color: #FF8000;">New</span> Exception<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;SQL Injection attack possible with:&quot;</span> <span style="color: #008000;">&amp;</span> psSQL<span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></pre></div></div>

<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F05%2F10%2Fsecure-database-against-sql-injection-attacks%2F&amp;linkname=Secure%20Database%20against%20SQL%20Injection%20attacks"><img src="http://www.rasikjain.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.rasikjain.com/2009/05/10/secure-database-against-sql-injection-attacks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>.NET (C# or VB.Net) libraries for Twitter API</title>
		<link>http://www.rasikjain.com/2009/05/06/net-csharp-or-vbnet-libraries-for-twitter-api/</link>
		<comments>http://www.rasikjain.com/2009/05/06/net-csharp-or-vbnet-libraries-for-twitter-api/#comments</comments>
		<pubDate>Wed, 06 May 2009 21:40:31 +0000</pubDate>
		<dc:creator>Rasik Jain</dc:creator>
				<category><![CDATA[C# (C-Sharp)]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.rasikjain.com/?p=42</guid>
		<description><![CDATA[I was looking for Twitter APIs or Wrapper classes which are built using .NET languages like C# or VB.NET. I have found some very good .NET libraries which are worth checking out them. If you are a .NET developer you can plugin these API libraries directly into your ASP.NET or Windows application without having to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F05%2F06%2Fnet-csharp-or-vbnet-libraries-for-twitter-api%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F05%2F06%2Fnet-csharp-or-vbnet-libraries-for-twitter-api%2F" height="61" width="51" /></a></div><p>I was looking for <a href="http://apiwiki.twitter.com/">Twitter APIs</a> or Wrapper classes which are built using .NET languages like C# or VB.NET. I have found some very good .NET libraries which are worth checking out them. If you are a .NET developer you can plugin these API libraries directly into your ASP.NET or Windows application without having to re-write everything from scratch in order to interact with twitter.</p>
<p>I have explored following APIs.</p>
<h2>TweetSharp API</h2>
<p>TweetSharp API is built using the .NET framework 3.0/3.5. It uses most of new features of C# like Linq, Implicit Variables, Extension Methods etc. TweetSharp can be used with silver light. Find more details about TweetSharp at <a title="TweetSharp" href="http://code.google.com/p/tweetsharp/" target="_blank">Google Code &#8211; TweetSharp</a></p>
<p>You can interact with twitter as shown the below.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">var twitter <span style="color: #008000;">=</span> FluentTwitter.<span style="color: #0000FF;">CreateRequest</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    .<span style="color: #0000FF;">AuthenticateAs</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;UserName&quot;</span>, <span style="color: #666666;">&quot;Password&quot;</span><span style="color: #000000;">&#41;</span>
    .<span style="color: #0000FF;">Statuses</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Update</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Hello World&quot;</span><span style="color: #000000;">&#41;</span>
    .<span style="color: #0000FF;">AsJson</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
var response <span style="color: #008000;">=</span> twitter.<span style="color: #0000FF;">Request</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<h2>Twitterizer</h2>
<p>Twitterizer is another .NET library which is promising. Already there are applications built using twitterizer. This Library provides simple to use functions and returns the user objects in the form of Collection Objects. Find more details at <a title="Twitterizer" href="http://twitterizer.googlecode.com" target="_blank">Google Code &#8211; Twitterizer</a></p>
<p>You can interact with twitter as shown the below.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">Twitter tw <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Twitter<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;UserName&quot;</span>, <span style="color: #666666;">&quot;Password&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
tw.<span style="color: #0000FF;">Status</span>.<span style="color: #0000FF;">Update</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Hello World&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<h2>Yedda Lib</h2>
<p>Yedda Lib is built using .NET 2.0 and C#. This is a simple and yet power library to use. When I checked this library last time there was no support for Direct Messages functionality. You can check more details at <a title="Yedda C# twitter library" href="http://devblog.yedda.com/index.php/twitter-c-library/" target="_blank">Yedda</a></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">Twitter tw <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Twitter<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">//Using String object</span>
<span style="color: #FF0000;">String</span> jsonFriends <span style="color: #008000;">=</span> tw.<span style="color: #0000FF;">GetFriendsAsJSON</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;UserName&quot;</span>, <span style="color: #666666;">&quot;Password&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">//Using XML Object</span>
XmlDocument xmlFriends <span style="color: #008000;">=</span> tw.<span style="color: #0000FF;">GetFriendsAsXML</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;UserName&quot;</span>, <span style="color: #666666;">&quot;Password&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<h2>TwitterVB</h2>
<p>TwitterVB is a VB.NET library released as open source under Google Code. TwitterVB includes a working implementation of Twitter&#8217;s OAuth authentication system, as well as Basic Authentication. Find more details about TwitterVB at <a title="TweetSharp" href="http://code.google.com/p/twittervb/" target="_blank">Google Code &#8211; TwitterVB</a></p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> tw <span style="color: #000080;">As</span> <span style="color: #000080;">New</span> TwitterVB.Twitter
tw = <span style="color: #000080;">New</span> TwitterVB.Twitter
tw.AuthenticateAs(<span style="color: #800000;">&quot;UserName&quot;</span>, <span style="color: #800000;">&quot;Password&quot;</span>)
&nbsp;
<span style="color: #008000;">' Post the tweet to Twitter
</span>tw.StatusMethods.Update(Me.txtPost.Text)</pre></div></div>

<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F05%2F06%2Fnet-csharp-or-vbnet-libraries-for-twitter-api%2F&amp;linkname=.NET%20%28C%23%20or%20VB.Net%29%20libraries%20for%20Twitter%20API"><img src="http://www.rasikjain.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.rasikjain.com/2009/05/06/net-csharp-or-vbnet-libraries-for-twitter-api/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Check database size on SQL Server using Excel Macro</title>
		<link>http://www.rasikjain.com/2009/05/04/check-database-size-on-sql-server-using-excel-macro/</link>
		<comments>http://www.rasikjain.com/2009/05/04/check-database-size-on-sql-server-using-excel-macro/#comments</comments>
		<pubDate>Tue, 05 May 2009 01:23:36 +0000</pubDate>
		<dc:creator>Rasik Jain</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Excel Macros]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[VB]]></category>

		<guid isPermaLink="false">http://www.rasikjain.com/?p=26</guid>
		<description><![CDATA[Following is a script to check the size of each database in a server. It checks the Database size, DBFile size and Log file size. Below code loops through all the databases on the selected server and exports the information to the Excel sheet.

&#160;
'Declare Variables for Server name, Database, DB File, Log File etc
Dim vServerName
Dim [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F05%2F04%2Fcheck-database-size-on-sql-server-using-excel-macro%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F05%2F04%2Fcheck-database-size-on-sql-server-using-excel-macro%2F" height="61" width="51" /></a></div><p>Following is a script to check the size of each database in a server. It checks the Database size, DBFile size and Log file size. Below code loops through all the databases on the selected server and exports the information to the Excel sheet.</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">&nbsp;
<span style="color: #008000;">'Declare Variables for Server name, Database, DB File, Log File etc
</span><span style="color: #000080;">Dim</span> vServerName
<span style="color: #000080;">Dim</span> objServer
<span style="color: #000080;">Dim</span> objDatabase
<span style="color: #000080;">Dim</span> objDBFile
<span style="color: #000080;">Dim</span> objLogFile
<span style="color: #000080;">Dim</span> xlApp
<span style="color: #000080;">Dim</span> xlBook
<span style="color: #000080;">Dim</span> xlSheet
<span style="color: #000080;">Dim</span> Row
<span style="color: #000080;">Dim</span> Cell
&nbsp;
<span style="color: #008000;">' Messagebox for server name
</span>vServerName = InputBox(<span style="color: #800000;">&quot;Please Enter Server Name:&quot;</span>,<span style="color: #800000;">&quot;Server Name&quot;</span>,<span style="color: #800000;">&quot;(local)&quot;</span>)
<span style="color: #000080;">If</span> vServerName = <span style="color: #800000;">&quot;&quot;</span> <span style="color: #000080;">Then</span>
vServerName = <span style="color: #800000;">&quot;(local)&quot;</span>
<span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
&nbsp;
<span style="color: #008000;">'Create Excel Object
</span><span style="color: #000080;">Set</span> xlApp = CreateObject(<span style="color: #800000;">&quot;Excel.Application&quot;</span>)
&nbsp;
<span style="color: #008000;">'Add Workbook to Excel Obj
</span><span style="color: #000080;">Set</span> xlBook = xlApp.Workbooks.Add
&nbsp;
<span style="color: #008000;">'Add Sheet to WorkBook
</span><span style="color: #000080;">Set</span> xlSheet = xlBook.Worksheets.Add
&nbsp;
<span style="color: #008000;">'Make Visibility for Excel App
</span>xlSheet.Application.Visible = <span style="color: #000080;">True</span>
&nbsp;
<span style="color: #008000;">' Set column headers
</span>xlSheet.Cells(1, 1) = <span style="color: #800000;">&quot;Database Name&quot;</span>
xlSheet.Cells(1, 2) = <span style="color: #800000;">&quot;Space used (MB)&quot;</span>
xlSheet.Cells(1, 3) = <span style="color: #800000;">&quot;Space Available (MB)&quot;</span>
xlSheet.Cells(1, 4) = <span style="color: #800000;">&quot;DBFile (MB)&quot;</span>
xlSheet.Cells(1, 5) = <span style="color: #800000;">&quot;LogFile (MB)&quot;</span>
Row = 2
&nbsp;
xlSheet.Rows(<span style="color: #800000;">&quot;1:1&quot;</span>).Font.Bold = <span style="color: #000080;">True</span>
xlSheet.Range(<span style="color: #800000;">&quot;B:E&quot;</span>).HorizontalAlignment = -4152
&nbsp;
<span style="color: #008000;">' Create the server object using SQL-DMO
</span><span style="color: #000080;">Set</span> objServer = CreateObject(<span style="color: #800000;">&quot;SQLDMO.SQLServer2&quot;</span>)
&nbsp;
<span style="color: #008000;">'Set Authentication for Server
</span><span style="color: #008000;">' Login with current Windows account
</span>objServer.LoginSecure = <span style="color: #000080;">True</span>
objServer.Connect vServerName
&nbsp;
&nbsp;
<span style="color: #008000;">'Loop through all the databases and get the properties of databases
</span><span style="color: #000080;">For</span> <span style="color: #000080;">each</span> objDatabase <span style="color: #000080;">in</span> objServer.Databases
&nbsp;
<span style="color: #000080;">SET</span> objDBFile = objDatabase.Filegroups(<span style="color: #800000;">&quot;PRIMARY&quot;</span>).DBFiles(1)
<span style="color: #000080;">SET</span> objLogFile = objDatabase.TransactionLog.LogFiles(1)
xlSheet.Cells(Row, 1).Value = objDatabase.Name
xlSheet.Cells(Row, 2).Value = objDatabase.Size
xlSheet.Cells(Row, 3).Value = Round(objDatabase.SpaceAvailableInMB,3)
xlSheet.Cells(Row, 4).Value = objDBFile.size
xlSheet.Cells(Row, 5).Value = objLogFile.size
&nbsp;
Row = Row + 1
<span style="color: #000080;">Set</span> objDBFile = <span style="color: #000080;">Nothing</span>
<span style="color: #000080;">Set</span> objLogFile = <span style="color: #000080;">Nothing</span>
<span style="color: #000080;">Next</span>
&nbsp;
xlSheet.Cells.EntireColumn.AutoFit
&nbsp;
&nbsp;
<span style="color: #008000;">'Save our changes
</span>xlBook.SaveAs (<span style="color: #800000;">&quot;C:\DBSpaceUsage.xls&quot;</span>)
xlBook.<span style="color: #000080;">Close</span>
&nbsp;
MsgBox <span style="color: #800000;">&quot;Check the file at C:\DBSpaceUsage.xls&quot;</span>
&nbsp;
<span style="color: #008000;">' Clean up memory
</span><span style="color: #000080;">Set</span> xlSheet = <span style="color: #000080;">Nothing</span>
<span style="color: #000080;">Set</span> xlBook = <span style="color: #000080;">Nothing</span>
<span style="color: #000080;">Set</span> xlApp = <span style="color: #000080;">Nothing</span>
<span style="color: #000080;">set</span> objDatabase = <span style="color: #000080;">Nothing</span>
<span style="color: #000080;">Set</span> objServer = <span style="color: #000080;">Nothing</span></pre></div></div>

<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F05%2F04%2Fcheck-database-size-on-sql-server-using-excel-macro%2F&amp;linkname=Check%20database%20size%20on%20SQL%20Server%20using%20Excel%20Macro"><img src="http://www.rasikjain.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.rasikjain.com/2009/05/04/check-database-size-on-sql-server-using-excel-macro/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Check File exists using .NET framework (VB.NET)</title>
		<link>http://www.rasikjain.com/2009/05/04/check-file-exists-using-net-framework-vbnet/</link>
		<comments>http://www.rasikjain.com/2009/05/04/check-file-exists-using-net-framework-vbnet/#comments</comments>
		<pubDate>Tue, 05 May 2009 01:15:36 +0000</pubDate>
		<dc:creator>Rasik Jain</dc:creator>
				<category><![CDATA[VB.Net]]></category>

		<guid isPermaLink="false">http://www.rasikjain.com/?p=22</guid>
		<description><![CDATA[Check If File Exists using VB.Net
FileInfo is a object derived from System.IO name space.
FileInfo has a property called “Exists”. This propery returns true if the file exists. False if file does not exists.

&#160;
=========&#40;VB.NET&#41;===============
Imports System.IO
&#160;
Declare Dim testfile As New FileInfo&#40;&#34;c:\My Document\testfile.txt&#34;&#41;
&#160;
If testfile.Exists&#40;&#41; Then
return true
Else
return false
End If

]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F05%2F04%2Fcheck-file-exists-using-net-framework-vbnet%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F05%2F04%2Fcheck-file-exists-using-net-framework-vbnet%2F" height="61" width="51" /></a></div><p>Check If File Exists using VB.Net</p>
<p>FileInfo is a object derived from System.IO name space.</p>
<p>FileInfo has a property called “Exists”. This propery returns true if the file exists. False if file does not exists.</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;">&nbsp;
<span style="color: #008000;">=========</span><span style="color: #000000;">&#40;</span>VB.<span style="color: #0000FF;">NET</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">===============</span>
<span style="color: #0600FF;">Imports</span> System.<span style="color: #0000FF;">IO</span>
&nbsp;
<span style="color: #0600FF;">Declare</span> <span style="color: #0600FF;">Dim</span> testfile <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> FileInfo<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;c:\My Document\testfile.txt&quot;</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #0600FF;">If</span> testfile.<span style="color: #0000FF;">Exists</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
<span style="color: #FF8000;">return</span> <span style="color: #0600FF;">true</span>
<span style="color: #FF8000;">Else</span>
<span style="color: #FF8000;">return</span> <span style="color: #0600FF;">false</span>
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></pre></div></div>

<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.rasikjain.com%2F2009%2F05%2F04%2Fcheck-file-exists-using-net-framework-vbnet%2F&amp;linkname=Check%20File%20exists%20using%20.NET%20framework%20%28VB.NET%29"><img src="http://www.rasikjain.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.rasikjain.com/2009/05/04/check-file-exists-using-net-framework-vbnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
