<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Web Code Blog</title>
	<atom:link href="http://webcodeblog.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://webcodeblog.com</link>
	<description>A web repository of coding tips and knowledge base articles</description>
	<lastBuildDate>Sat, 19 May 2012 10:33:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='webcodeblog.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/982c870b975c6324798cc43cefd87d58?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Web Code Blog</title>
		<link>http://webcodeblog.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://webcodeblog.com/osd.xml" title="Web Code Blog" />
	<atom:link rel='hub' href='http://webcodeblog.com/?pushpress=hub'/>
		<item>
		<title>Obtaining XML Node Order when using SQL Server</title>
		<link>http://webcodeblog.com/2012/01/11/obtaining-xml-node-order-when-using-sql-server/</link>
		<comments>http://webcodeblog.com/2012/01/11/obtaining-xml-node-order-when-using-sql-server/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 04:31:39 +0000</pubDate>
		<dc:creator>Stefan Zvonar</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://webcodeblog.com/?p=242</guid>
		<description><![CDATA[Unfortunately, when reading / shredding XML document from SQL Server, there are no guarantees in the order in which SQL Server will read the XML nodes.  This can prove particularly troublesome if your code or import procedure relies on a specific order.  When you run your script, the order it retrieves the XML is random [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=242&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Unfortunately, when reading / shredding XML document from SQL Server, there are no guarantees in the order in which SQL Server will read the XML nodes.  This can prove particularly troublesome if your code or import procedure relies on a specific order.  When you run your script, the order it retrieves the XML is random and can be the cause of some intermittent results – which can contribute to hair loss.</p>
<p>Your first thought, may be to try and use the “position()” function in your retrieval script, but alas, this will not work.</p>
<p>The below solution is a bit of a hack, but it seems to work regardless of how many times I run the script and I can guarantee the order in which the node information was presented in the XML.</p>
<p>First, let’s assume you have an XML parameter, or XML column in a table in your database.  Here, we are just going to create a dummy XML data type for demonstration purposes.</p>
<div style="color:black;background:white;font-family:Courier New;font-size:10pt;padding:8px;">
<p style="margin:0;"><span style="color:blue;">DECLARE</span> @Xml <span style="color:blue;">XML</span></p>
<p style="background:#ededed;margin:0;"><span style="color:blue;">SET</span> @Xml <span style="color:gray;">=</span> <span style="color:red;">&#8216;</span></p>
<p style="margin:0;"><span style="color:red;">&lt;Data&gt;</span></p>
<p style="background:#ededed;margin:0;"><span style="color:red;">&nbsp;&nbsp;&nbsp; &lt;Field&gt;</span></p>
<p style="margin:0;"><span style="color:red;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;Name&gt;Person&lt;/Name&gt;</span></p>
<p style="background:#ededed;margin:0;"><span style="color:red;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;Value&gt;Joe Bloggs&lt;/Value&gt;</span></p>
<p style="margin:0;"><span style="color:red;">&nbsp;&nbsp;&nbsp; &lt;/Field&gt;</span></p>
<p style="background:#ededed;margin:0;"><span style="color:red;">&nbsp;&nbsp;&nbsp; &lt;Field&gt;</span></p>
<p style="margin:0;"><span style="color:red;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;Name&gt;Telephone&lt;/Name&gt;</span></p>
<p style="background:#ededed;margin:0;"><span style="color:red;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;Value&gt;12345678&lt;/Value&gt;</span></p>
<p style="margin:0;"><span style="color:red;">&nbsp;&nbsp;&nbsp; &lt;/Field&gt;</span></p>
<p style="background:#ededed;margin:0;"><span style="color:red;">&nbsp;&nbsp;&nbsp; &lt;Field&gt;</span></p>
<p style="margin:0;"><span style="color:red;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;Name&gt;Address&lt;/Name&gt;</span></p>
<p style="background:#ededed;margin:0;"><span style="color:red;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;Value&gt;1 Blah Street&lt;/Value&gt;</span></p>
<p style="margin:0;"><span style="color:red;">&nbsp;&nbsp;&nbsp; &lt;/Field&gt;</span></p>
<p style="background:#ededed;margin:0;"><span style="color:red;">&lt;/Data&gt;</span></p>
<p style="margin:0;"><span style="color:red;">&#8216;</span></p>
</div>
<p>Now, we are going to create a temporary table which is simply full of sequential numbers which should cater for the number of nodes you are expecting.  Note, in my case, I was reading XML describing the fields I was expecting, so 100 numbers here is more than enough.  You may require more.  </p>
<p>Here I create the table to consist of 100 numbers (as that is more than enough to cover the number of fields I am expecting).  </p>
<div style="color:black;background:white;font-family:Courier New;font-size:10pt;padding:8px;">
<p style="margin:0;"><span style="color:blue;">DECLARE</span> @Numbers <span style="color:blue;">TABLE</span><span style="color:gray;">(</span>num <span style="color:blue;">int</span> <span style="color:blue;">identity</span><span style="color:gray;">(</span>1<span style="color:gray;">,</span>1<span style="color:gray;">))</span></p>
<p style="background:#ededed;margin:0;"><span style="color:blue;">INSERT</span> @Numbers <span style="color:blue;">DEFAULT</span> <span style="color:blue;">VALUES</span><span style="color:gray;">;</span></p>
<p style="margin:0;"><span style="color:blue;">WHILE</span> <span style="color:fuchsia;">SCOPE_IDENTITY</span><span style="color:gray;">()</span> <span style="color:gray;">&lt;</span> 100</p>
<p style="background:#ededed;margin:0;">&nbsp;&nbsp;&nbsp; <span style="color:blue;">INSERT</span> @Numbers <span style="color:blue;">DEFAULT</span> <span style="color:blue;">VALUES</span><span style="color:gray;">;</span></p>
</div>
<p>Then, we are going to perform the query on the XML, to retrieve the field information, combined with the order in which the node is stored in the XML.</p>
<div style="color:black;background:white;font-family:Courier New;font-size:10pt;padding:8px;">
<p style="margin:0;"><span style="color:blue;">SELECT</span> <span style="color:gray;">*</span></p>
<p style="background:#ededed;margin:0;"><span style="color:blue;">INTO</span> #Fields&nbsp;&nbsp; </p>
<p style="margin:0;"><span style="color:blue;">FROM</span>&nbsp; </p>
<p style="background:#ededed;margin:0;"><span style="color:gray;">(</span></p>
<p style="margin:0;">&nbsp;&nbsp;&nbsp; <span style="color:blue;">SELECT</span> </p>
<p style="background:#ededed;margin:0;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color:green;">&#8211;Fields.Field.value(&#8216;position()&#8217;, &#8216;int&#8217;) AS Order,&nbsp; &#8212; Unfortunately, this will not work!</span></p>
<p style="margin:0;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; n<span style="color:gray;">.</span>num <span style="color:blue;">AS</span> [Order]<span style="color:gray;">,</span></p>
<p style="background:#ededed;margin:0;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Fields<span style="color:gray;">.</span>Field<span style="color:gray;">.</span>value<span style="color:gray;">(</span><span style="color:red;">&#8216;./Name[1]&#8216;</span><span style="color:gray;">,</span> <span style="color:red;">&#8216;varchar(50)&#8217;</span><span style="color:gray;">)</span> <span style="color:blue;">AS</span> FieldName<span style="color:gray;">,</span></p>
<p style="margin:0;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Fields<span style="color:gray;">.</span>Field<span style="color:gray;">.</span>value<span style="color:gray;">(</span><span style="color:red;">&#8216;./Value[1]&#8216;</span><span style="color:gray;">,</span> <span style="color:red;">&#8216;varchar(50)&#8217;</span><span style="color:gray;">)</span> <span style="color:blue;">AS</span> FieldValue</p>
<p style="background:#ededed;margin:0;">&nbsp;&nbsp;&nbsp; <span style="color:blue;">FROM</span> @Numbers n</p>
<p style="margin:0;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color:gray;">CROSS</span> <span style="color:gray;">APPLY</span> @Xml<span style="color:gray;">.</span>nodes<span style="color:gray;">(</span><span style="color:red;">&#8216;/Data/Field[sql:column(&quot;n.num&quot;)]&#8216;</span><span style="color:gray;">)</span> <span style="color:blue;">AS</span> Fields<span style="color:gray;">(</span>Field<span style="color:gray;">)</span></p>
<p style="background:#ededed;margin:0;"><span style="color:gray;">)</span> <span style="color:blue;">AS</span> f</p>
<p style="margin:0;">&nbsp;</p>
<p style="background:#ededed;margin:0;"><span style="color:blue;">SELECT</span> <span style="color:gray;">*</span> <span style="color:blue;">FROM</span> #Fields</p>
<p style="margin:0;">&nbsp;</p>
<p style="background:#ededed;margin:0;"><span style="color:blue;">DROP</span> <span style="color:blue;">TABLE</span> #Fields</p>
</div>
<p>Below is an example of what is returned:</p>
<div id="attachment_251" class="wp-caption aligncenter" style="width: 268px"><a href="http://webcodeblog.files.wordpress.com/2012/01/sqlxmlnodeorder_1.jpg"><img src="http://webcodeblog.files.wordpress.com/2012/01/sqlxmlnodeorder_1.jpg" alt="" title="Ordered Node Values in Table" width="258" height="118" class="size-full wp-image-251" /></a><p class="wp-caption-text">Ordered Node Values in Table</p></div>
<p>As you can see, it provides you now with a temporary table and column that defines the order in which the XML node was presented in the XML.  You can then sort this table by the order column if you so wish, join by it, or whatever it is you need to do!</p>
<p>Hope this helps,</p>
<p>Stefan.</p>
<p>For more Web Code, ASP.NET, SQL Server and other development tips, please check back here at webcodeblog.com often.</p>
<br />Filed under: <a href='http://webcodeblog.com/category/sql-server/'>SQL Server</a>, <a href='http://webcodeblog.com/category/xml/'>XML</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webcodeblog.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webcodeblog.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webcodeblog.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webcodeblog.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webcodeblog.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webcodeblog.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webcodeblog.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webcodeblog.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webcodeblog.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webcodeblog.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webcodeblog.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webcodeblog.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webcodeblog.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webcodeblog.wordpress.com/242/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=242&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webcodeblog.com/2012/01/11/obtaining-xml-node-order-when-using-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/699d1b9d00561bf0dcf5b2a7a24f171e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stefanzv</media:title>
		</media:content>

		<media:content url="http://webcodeblog.files.wordpress.com/2012/01/sqlxmlnodeorder_1.jpg" medium="image">
			<media:title type="html">Ordered Node Values in Table</media:title>
		</media:content>
	</item>
		<item>
		<title>Executing xp_cmdshell with SQL Server 2008 R2</title>
		<link>http://webcodeblog.com/2011/11/18/executing-xp_cmdshell-with-sql-server-2008-r2/</link>
		<comments>http://webcodeblog.com/2011/11/18/executing-xp_cmdshell-with-sql-server-2008-r2/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 07:49:09 +0000</pubDate>
		<dc:creator>Stefan Zvonar</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://webcodeblog.com/?p=232</guid>
		<description><![CDATA[Sometimes there comes a time when you would like to have a user of your database be able to execute a program by making use of SQL Server’s xp_cmdshell procedure.  It can be a little tricky setting up the permissions to enable this call, so here are some steps you can take to make it [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=232&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Sometimes there comes a time when you would like to have a user of your database be able to execute a program by making use of SQL Server’s xp_cmdshell procedure.  It can be a little tricky setting up the permissions to enable this call, so here are some steps you can take to make it possible.</p>
<p>Firstly, allow execution of xp_cmdshell:</p>
<pre><span style="color:#0000ff;">USE </span><span style="color:#000000;">[master]</span>
<span style="color:#0000ff;">GO</span>
<span style="color:#0000ff;">EXEC </span><span style="color:#000000;">sp_configure </span><span style="color:#a31515;">'xp_cmdshell'</span><span style="color:#000000;">, 1 </span><span style="color:#0000ff;">RECONFIGURE </span>
<span style="color:#0000ff;">GO</span></pre>
<p>Secondly, create a SQL Login that can run xp_cmdshell.  Please create a more secure password than the example given:</p>
<pre><span style="color:#0000ff;">USE</span><span style="color:#000000;"> [master] </span>
<span style="color:#0000ff;">GO</span>
<span style="color:#0000ff;">CREATE</span><span style="color:#0000ff;"> LOGIN</span><span style="color:#000000;"> [CommandShellLogin] </span><span style="color:#0000ff;">WITH</span><span style="color:#0000ff;"> PASSWORD </span><span style="color:#808080;">=</span><span style="color:#ff0000;">'abc123!@#' </span>
<span style="color:#0000ff;">GO</span>
<span style="color:#0000ff;">CREATE</span><span style="color:#ff00ff;"> USER</span><span style="color:#000000;"> [CommandShellLogin] </span><span style="color:#0000ff;">FROM</span><span style="color:#0000ff;"> LOGIN</span><span style="color:#000000;"> [CommandShellLogin] </span>
<span style="color:#0000ff;">GO</span>
<span style="color:#0000ff;">GRANT</span><span style="color:#0000ff;"> EXECUTE</span><span style="color:#0000ff;">ON</span><span style="color:#800000;"> xp_cmdshell</span><span style="color:#0000ff;"> TO</span><span style="color:#000000;"> [CommandShellLogin] </span>
<span style="color:#0000ff;">GO</span></pre>
<p>Thirdly, because you will be switching to this command shell login temporarily, grant impersonation rights to the user&#8217;s group. Note: Am assuming that the user group is mapped to a login in SQL Server:</p>
<pre><span style="color:#0000ff;">USE</span><span style="color:#000000;"> [master] </span>
<span style="color:#0000ff;">GO</span>
<span style="color:#0000ff;">GRANT</span><span style="color:#000000;"> IMPERSONATE </span><span style="color:#0000ff;">ON</span><span style="color:#0000ff;"> LOGIN</span><span style="color:#808080;">::</span><span style="color:#000000;">CommandShellLogin </span><span style="color:#0000ff;">TO</span><span style="color:#000000;"> [DOMAIN\USER GROUP] </span>
<span style="color:#0000ff;">GO</span></pre>
<p>Now, you could make [CommandShellLogin] a member of sysadmin to make this work, but that would be providing too much priviledges. Instead, you can set up a proxy account that xp_cmdshell uses whenever it is called. This will be an actual windows account that the command will execute as, so make sure that the windows account has the permissions to perform whatever it is you are intending it to execute:</p>
<pre><span style="color:#0000ff;">EXEC </span><span style="color:#800000;">sp_xp_cmdshell_proxy_account</span><span style="color:#ff0000;"> 'DOMAIN\User'</span><span style="color:#808080;">,</span><span style="color:#ff0000;"> 'UserPassword' </span>
<span style="color:#0000ff;">GO</span></pre>
<p>Now in your procedure, trigger, script or whereever you plan on running xp_cmdshell, switch the context to the CommandShellLogin user temporarily to execute your desired command. Here we are just running DIR as an example:</p>
<pre><span style="color:#0000ff;">EXECUTE </span><span style="color:#0000ff;">AS</span><span style="color:#0000ff;"> LOGIN</span><span style="color:#808080;"> = </span><span style="color:#ff0000;">'CommandShellLogin' </span>
<span style="color:#0000ff;">EXEC</span><span style="color:#800000;"> xp_cmdshell</span><span style="color:#ff0000;"> 'DIR' </span>
<span style="color:#0000ff;">REVERT</span></pre>
<p>Note: Setting up the proxy account above results in any xp_cmdshell to run as the user specified. If you no longer want subsequent calls to xp_cmdshell to run as that windows account, then ensure that you empty the proxy account so that it does not run anymore as that account:</p>
<pre><span style="color:#0000ff;">EXEC</span><span style="color:#800000;"> sp_xp_cmdshell_proxy_account </span><span style="color:#808080;">NULL </span></pre>
<p>Hope this helps,</p>
<p>Stefan.</p>
<p>For more Web Code, ASP.NET, SQL Server and other development tips, please check back here at webcodeblog.com often.</p>
<br />Filed under: <a href='http://webcodeblog.com/category/sql-server/'>SQL Server</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webcodeblog.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webcodeblog.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webcodeblog.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webcodeblog.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webcodeblog.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webcodeblog.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webcodeblog.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webcodeblog.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webcodeblog.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webcodeblog.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webcodeblog.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webcodeblog.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webcodeblog.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webcodeblog.wordpress.com/232/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=232&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webcodeblog.com/2011/11/18/executing-xp_cmdshell-with-sql-server-2008-r2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/699d1b9d00561bf0dcf5b2a7a24f171e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stefanzv</media:title>
		</media:content>
	</item>
		<item>
		<title>Quickly check if network file or path exists in VB.NET</title>
		<link>http://webcodeblog.com/2011/05/31/checkfilepathexistsvbnet/</link>
		<comments>http://webcodeblog.com/2011/05/31/checkfilepathexistsvbnet/#comments</comments>
		<pubDate>Tue, 31 May 2011 02:13:41 +0000</pubDate>
		<dc:creator>Stefan Zvonar</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://webcodeblog.com/?p=225</guid>
		<description><![CDATA[This little article explains a way to check if a file or path exists in code, without having to wait a long time for the result if the network is down or the path does not exist. For example, in my particular case, I wanted a way to check for connectivity to the network before [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=225&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This little article explains a way to check if a file or path exists in code, without having to wait a long time for the result if the network is down or the path does not exist.</p>
<p>For example, in my particular case, I wanted a way to check for connectivity to the network before accessing the server file system. Scaling the internet I found some good C# examples (like this one: http://stackoverflow.com/questions/1232953/speed-up-file-exists-for-non-existing-network-shares)</p>
<p>However, the application I was working on was developed in VB.Net and the threading code is quite different between the languages.</p>
<p>The first problem I encountered was trying to pass a variable to the threading function. After some playing around, I was able to produce the following in VB.Net (based on the example in the link above) and using Visual Studio 2008.</p>
<pre>   <span style="color:blue;">Public</span> <span style="color:blue;">Function</span> PathExists(<span style="color:blue;">ByVal</span> path <span style="color:blue;">As</span> <span style="color:blue;">String</span>, <span style="color:blue;">ByVal</span> timeout <span style="color:blue;">As</span> <span style="color:blue;">Integer</span>) <span style="color:blue;">As</span> <span style="color:blue;">Boolean</span>
        <span style="color:blue;">Dim</span> exists <span style="color:blue;">As</span> <span style="color:blue;">Boolean</span> = <span style="color:blue;">True</span>
        <span style="color:blue;">Dim</span> t <span style="color:blue;">As</span> <span style="color:blue;">New</span> Thread(<span style="color:blue;">DirectCast</span>(<span style="color:blue;">Function</span>() CheckPathFunction(path), ThreadStart))
        t.Start()
        <span style="color:blue;">Dim</span> completed <span style="color:blue;">As</span> <span style="color:blue;">Boolean</span> = t.Join(timeout)
        <span style="color:blue;">If</span> <span style="color:blue;">Not</span> completed <span style="color:blue;">Then</span>
            exists = <span style="color:blue;">False</span>
            t.Abort()
        <span style="color:blue;">End</span> <span style="color:blue;">If</span>
        <span style="color:blue;">Return</span> exists
    <span style="color:blue;">End</span> <span style="color:blue;">Function</span>

    <span style="color:blue;">Public</span> <span style="color:blue;">Function</span> CheckPathFunction(<span style="color:blue;">ByVal</span> path <span style="color:blue;">As</span> <span style="color:blue;">String</span>) <span style="color:blue;">As</span> <span style="color:blue;">Boolean</span>
        <span style="color:blue;">Return</span> System.IO.File.Exists(path)
    <span style="color:blue;">End</span> <span style="color:blue;">Function </span></pre>
<p>Note: To use this method, you would call the function like done below, passing in an integer representing milliseconds before it stops trying to reach the path &#8211; in this case I have set it to 3 seconds.</p>
<pre><span style="color:#0000ff;">If</span><span style="color:#000000;"> PathExists(</span><span style="color:#a31515;">"\\BLAH\PATH\"</span><span style="color:#000000;">, 3000) </span><span style="color:#0000ff;">Then </span>
...
<span style="color:#0000ff;">End</span><span style="color:#0000ff;"> If</span></pre>
<p>Hope this helps,</p>
<p>Stefan.</p>
<p>For more Web Code, ASP.NET, SQL Server and other development tips, please check back here at webcodeblog.com often.</p>
<br />Filed under: <a href='http://webcodeblog.com/category/net/'>.NET</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webcodeblog.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webcodeblog.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webcodeblog.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webcodeblog.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webcodeblog.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webcodeblog.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webcodeblog.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webcodeblog.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webcodeblog.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webcodeblog.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webcodeblog.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webcodeblog.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webcodeblog.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webcodeblog.wordpress.com/225/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=225&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webcodeblog.com/2011/05/31/checkfilepathexistsvbnet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/699d1b9d00561bf0dcf5b2a7a24f171e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stefanzv</media:title>
		</media:content>
	</item>
		<item>
		<title>ASP.NET website not working with DNS Alias</title>
		<link>http://webcodeblog.com/2011/04/05/asp-net-website-not-working-with-dns-alias/</link>
		<comments>http://webcodeblog.com/2011/04/05/asp-net-website-not-working-with-dns-alias/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 04:38:21 +0000</pubDate>
		<dc:creator>Stefan Zvonar</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[IIS]]></category>

		<guid isPermaLink="false">http://webcodeblog.com/?p=219</guid>
		<description><![CDATA[This is a curious bit of information I have stumbled upon. An ASP.NET Web Site will not persist session variables between requests when the host name has an underscore (&#8220;_&#8221;) in it. This is only apparent when using Internet Explorer. Turns out that underscores are against the standard of naming servers. The particular server I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=219&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is a curious bit of information I have stumbled upon.</p>
<p>An ASP.NET Web Site will not persist session variables between requests when the host name has an underscore (&#8220;_&#8221;) in it.  This is only apparent when using Internet Explorer.</p>
<p>Turns out that underscores are against the standard of naming servers.  The particular server I was using decided they wanted to use a DNS Alias for all requests (in case of server name changes in the future).  However, the alias itself had an underscore in it, which stopped page requests from working properly in the ASP.NET web site.</p>
<p>Here is a little summary from Microsoft:</p>
<p><u>SYMPTOMS</u></p>
<p>After you install security patch MS01-055 for Microsoft Internet Explorer 5.5 or 6.0, you may encounter the following problems:</p>
<p>    * Session variables are lost.<br />
    * Session state is not maintained between requests.<br />
    * Cookies are not set on the client system.</p>
<p>Note These problems can also occur after you install a more recent patch that includes the fix that is provided in security patch MS01-055.</p>
<p><u>CAUSE</u><br />
Security patch MS01-055 prevents servers with improper name syntax from setting&#8230;<br />
Security patch MS01-055 prevents servers with improper name syntax from setting cookies names. Domains that use cookies must use only alphanumeric characters (&#8220;-&#8221; or &#8220;.&#8221;) in the domain name and the server name. Internet Explorer blocks cookies from a server if the server name contains other characters, such as an underscore character (&#8220;_&#8221;).</p>
<p>Because ASP session state and session variables rely on cookies to function, ASP cannot maintain session state between requests if cookies cannot be set on the client.</p>
<p>This issue can also be caused by an incorrect name syntax in a host header.</p>
<p><u>RESOLUTION</u><br />
To work around this problem, use one of the following methods: Rename the domai&#8230;<br />
To work around this problem, use one of the following methods:</p>
<p>    * Rename the domain name and the server name, and use only alphanumeric characters.<br />
    * Browse to the server by using the Internet Protocol (IP) address rather than the domain/server name.</p>
<p>Note You may need to change the Microsoft Internet Information Server (IIS) configuration after you rename a server. </p>
<p>Click <a href="http://support.microsoft.com/kb/316112">here</a> to read the full Microsoft Support Article.</p>
<p>Hope this helps,</p>
<p>Stefan.</p>
<p>For more Web Code, ASP.NET, SQL Server and other development tips, please check back here at webcodeblog.com often.</p>
<br />Filed under: <a href='http://webcodeblog.com/category/net/'>.NET</a>, <a href='http://webcodeblog.com/category/net/asp-net/'>ASP.NET</a>, <a href='http://webcodeblog.com/category/iis/'>IIS</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webcodeblog.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webcodeblog.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webcodeblog.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webcodeblog.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webcodeblog.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webcodeblog.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webcodeblog.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webcodeblog.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webcodeblog.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webcodeblog.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webcodeblog.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webcodeblog.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webcodeblog.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webcodeblog.wordpress.com/219/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=219&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webcodeblog.com/2011/04/05/asp-net-website-not-working-with-dns-alias/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/699d1b9d00561bf0dcf5b2a7a24f171e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stefanzv</media:title>
		</media:content>
	</item>
		<item>
		<title>Find out what service pack and edition your SQL Server installation is</title>
		<link>http://webcodeblog.com/2011/04/04/find-out-what-service-pack-and-edition-your-sql-server-installation-is/</link>
		<comments>http://webcodeblog.com/2011/04/04/find-out-what-service-pack-and-edition-your-sql-server-installation-is/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 07:19:56 +0000</pubDate>
		<dc:creator>Stefan Zvonar</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://webcodeblog.com/?p=211</guid>
		<description><![CDATA[Here is a quick little T-SQL script to run to find out some basic version, service pack and edition your SQL Server Instance is running: SELECT SERVERPROPERTY('productversion') AS [Version], SERVERPROPERTY ('productlevel') AS [Service Pack], SERVERPROPERTY ('edition') AS [Edition] The complete knowledge base article can be found here. Hope this helps, Stefan. For more Web Code, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=211&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here is a quick little T-SQL script to run to find out some basic version, service pack and edition your SQL Server Instance is running:</p>
<pre><span style='color:#000000;'></span><span style='color:#0000ff;'>SELECT</span><span style='color:#000000;'> </span><span style='color:#ff00ff;'>SERVERPROPERTY</span><span style='color:#808080;'>(</span><span style='color:#ff0000;'>'productversion'</span><span style='color:#808080;'>)</span><span style='color:#000000;'> </span><span style='color:#0000ff;'>AS</span><span style='color:#000000;'> [Version]</span><span style='color:#808080;'>,</span><span style='color:#000000;'> </span><span style='color:#ff00ff;'>SERVERPROPERTY</span><span style='color:#000000;'> </span><span style='color:#808080;'>(</span><span style='color:#ff0000;'>'productlevel'</span><span style='color:#808080;'>)</span><span style='color:#000000;'> </span><span style='color:#0000ff;'>AS</span><span style='color:#000000;'> [Service Pack]</span><span style='color:#808080;'>,</span><span style='color:#000000;'> </span><span style='color:#ff00ff;'>SERVERPROPERTY</span><span style='color:#000000;'> </span><span style='color:#808080;'>(</span><span style='color:#ff0000;'>'edition'</span><span style='color:#808080;'>)</span><span style='color:#000000;'> </span><span style='color:#0000ff;'>AS</span><span style='color:#000000;'> [Edition]</span></pre>
<p>The complete knowledge base article can be found <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;q321185">here</a>.</p>
<p>Hope this helps,</p>
<p>Stefan.</p>
<p>For more Web Code, ASP.NET, SQL Server and other development tips, please check back here at webcodeblog.com often.</p>
<br />Filed under: <a href='http://webcodeblog.com/category/sql-server/'>SQL Server</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webcodeblog.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webcodeblog.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webcodeblog.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webcodeblog.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webcodeblog.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webcodeblog.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webcodeblog.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webcodeblog.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webcodeblog.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webcodeblog.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webcodeblog.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webcodeblog.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webcodeblog.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webcodeblog.wordpress.com/211/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=211&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webcodeblog.com/2011/04/04/find-out-what-service-pack-and-edition-your-sql-server-installation-is/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/699d1b9d00561bf0dcf5b2a7a24f171e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stefanzv</media:title>
		</media:content>
	</item>
		<item>
		<title>Using KDiff for your TFS comparison and merging tool</title>
		<link>http://webcodeblog.com/2011/01/04/using-kdiff-for-your-tfs-comparison-and-merging-tool/</link>
		<comments>http://webcodeblog.com/2011/01/04/using-kdiff-for-your-tfs-comparison-and-merging-tool/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 05:47:16 +0000</pubDate>
		<dc:creator>Stefan Zvonar</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://webcodeblog.com/?p=196</guid>
		<description><![CDATA[TFS is a great source control solution, however it can be a pain when trying to merge or even compare code when merging branches together (especially when you cut and paste code into a new IF statement &#8211; the code comparison gets shuffled down considerably, making comparing the two changesets very difficult). Thankfully, KDiff is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=196&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>TFS is a great source control solution, however it can be a pain when trying to merge or even compare code when merging branches together (especially when you cut and paste code into a new IF statement &#8211; the code comparison gets shuffled down considerably, making comparing the two changesets very difficult).</p>
<p>Thankfully, KDiff is a free tool which performs much better than the default tools (in my opinion).</p>
<p>You can download and install KDiff from here:</p>
<p><a title="http://kdiff3.sourceforge.net/" href="http://kdiff3.sourceforge.net/" target="_blank">http://kdiff3.sourceforge.net/</a></p>
<p>Once you have installed Kdiff, it is now time to configure TFS.</p>
<p><em>Go to Tools -&gt; Options:</em></p>
<p><a href="http://webcodeblog.files.wordpress.com/2011/01/1.jpg"><img class="aligncenter size-medium wp-image-197" title="Options" src="http://webcodeblog.files.wordpress.com/2011/01/1.jpg?w=229&h=300" alt="Options" width="229" height="300" /></a></p>
<p><em>Go to Source Control -&gt; Visual Studio Team Foundation Server -&gt; Configure User Tools</em>:</p>
<p><a href="http://webcodeblog.files.wordpress.com/2011/01/2.jpg"><img class="aligncenter size-medium wp-image-198" title="Configure User Tools" src="http://webcodeblog.files.wordpress.com/2011/01/2.jpg?w=300&h=172" alt="Configure User Tools" width="300" height="172" /></a></p>
<p>You will now want to <em>add </em>two new operations for comparing and merging.</p>
<p><em>Note, in the following picture examples, replace ‘C:\Program Files\KDiff3’ with the path where you have installed KDiff.</em></p>
<p><em><br />
</em></p>
<p><span style="text-decoration:underline;">Compare operations</span></p>
<p><a href="http://webcodeblog.files.wordpress.com/2011/01/3.jpg"><img class="aligncenter size-medium wp-image-199" title="Compare Operator" src="http://webcodeblog.files.wordpress.com/2011/01/3.jpg?w=300&h=157" alt="Compare Operator" width="300" height="157" /></a></p>
<p>Note, the arguments are:</p>
<p>%1 &#8211;fname %6 %2 &#8211;fname %7</p>
<p><span style="text-decoration:underline;">Merge operations</span></p>
<p><a href="http://webcodeblog.files.wordpress.com/2011/01/4.jpg"><img class="aligncenter size-medium wp-image-200" title="Merge Operator" src="http://webcodeblog.files.wordpress.com/2011/01/4.jpg?w=300&h=155" alt="Merge Operator" width="300" height="155" /></a></p>
<p>Note, the arguments are:</p>
<p>%3 &#8211;fname %8 %2 &#8211;fname %7 %1 &#8211;fname %6 -o %4</p>
<p>That should be it.  This will now ensure that TFS will use the KDiff tool when comparing any type of file.  Note, you can change these operations to be specific to certain code files (instead of an ‘.*’ extension, you could use ‘.vb’,  for example)</p>
<p>If you would like more information on the arguments used or use a different comparison tool, please read the following informative post:</p>
<p><a title="http://blogs.msdn.com/b/jmanning/archive/2006/02/20/diff-merge-configuration-in-team-foundation-common-command-and-argument-values.aspx" href="http://blogs.msdn.com/b/jmanning/archive/2006/02/20/diff-merge-configuration-in-team-foundation-common-command-and-argument-values.aspx" target="_blank">http://blogs.msdn.com/b/jmanning/archive/2006/02/20/diff-merge-configuration-in-team-foundation-common-command-and-argument-values.aspx</a></p>
<p>Hope this helps,</p>
<p>Stefan.</p>
<p>For more Web Code, ASP.NET, SQL Server and other development tips, please check back here at webcodeblog.com often.</p>
<br />Filed under: <a href='http://webcodeblog.com/category/team-foundation-server/'>Team Foundation Server</a>, <a href='http://webcodeblog.com/category/visual-studio/'>Visual Studio</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webcodeblog.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webcodeblog.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webcodeblog.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webcodeblog.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webcodeblog.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webcodeblog.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webcodeblog.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webcodeblog.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webcodeblog.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webcodeblog.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webcodeblog.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webcodeblog.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webcodeblog.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webcodeblog.wordpress.com/196/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=196&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webcodeblog.com/2011/01/04/using-kdiff-for-your-tfs-comparison-and-merging-tool/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/699d1b9d00561bf0dcf5b2a7a24f171e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stefanzv</media:title>
		</media:content>

		<media:content url="http://webcodeblog.files.wordpress.com/2011/01/1.jpg?w=229" medium="image">
			<media:title type="html">Options</media:title>
		</media:content>

		<media:content url="http://webcodeblog.files.wordpress.com/2011/01/2.jpg?w=300" medium="image">
			<media:title type="html">Configure User Tools</media:title>
		</media:content>

		<media:content url="http://webcodeblog.files.wordpress.com/2011/01/3.jpg?w=300" medium="image">
			<media:title type="html">Compare Operator</media:title>
		</media:content>

		<media:content url="http://webcodeblog.files.wordpress.com/2011/01/4.jpg?w=300" medium="image">
			<media:title type="html">Merge Operator</media:title>
		</media:content>
	</item>
		<item>
		<title>Click Once Application Error &#8211; The signer&#8217;s certificate is not valid for signing</title>
		<link>http://webcodeblog.com/2010/11/17/click-once-application-error-the-signers-certificate-is-not-valid-for-signing/</link>
		<comments>http://webcodeblog.com/2010/11/17/click-once-application-error-the-signers-certificate-is-not-valid-for-signing/#comments</comments>
		<pubDate>Wed, 17 Nov 2010 23:52:47 +0000</pubDate>
		<dc:creator>Stefan Zvonar</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://webcodeblog.com/?p=191</guid>
		<description><![CDATA[Problem: When trying to publish a Click Once application, you recieve the following error: &#8220;The signer&#8217;s certificate is not valid for signing.&#8221; Reason: This is most likely due to the fact that the certificate used to publish the application originally has expired.  Most certificates have a lifespan of about a year, so it needs updating [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=191&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="text-decoration:underline;">Problem: </span></p>
<p>When trying to publish a Click Once application, you recieve the following error:<br />
<em> &#8220;The signer&#8217;s certificate is not valid for signing.&#8221;</em><br />
<span style="text-decoration:underline;">Reason:</span><br />
This is most likely due to the fact that the certificate used to publish the application originally has expired.  Most certificates have a lifespan of about a year, so it needs updating now and then, especially when publishing new versions of the application.</p>
<p><span style="text-decoration:underline;">Solution: </span><br />
To get around this problem, you need to create a new certificate.<br />
Open your project in Visual Studio and go to the Project menu -&gt; Project Properties.  Click on the Signing tab and click on the &#8220;Create Test Certificate&#8221; button (as shown in the image below).</p>
<div id="attachment_192" class="wp-caption aligncenter" style="width: 310px"><a href="http://webcodeblog.files.wordpress.com/2010/11/createtestcertificate.jpg"><img class="size-medium wp-image-192" title="Create Test Certificate" src="http://webcodeblog.files.wordpress.com/2010/11/createtestcertificate.jpg?w=300&h=182" alt="Create Test Certificate" width="300" height="182" /></a><p class="wp-caption-text">Create Test Certificate</p></div>
<p>I left the password blank, but if you do use a password, be sure to remember it a year later, or whenever you need to regenerate another certificate <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
This will place a ????.pfx file in your project.  This file contains the private and public key informaiton.  I simply removed the old file (backed it up first) and renamed my new generated file to the old file name.<br />
You should now be able to publish your Click Once application.</p>
<p>Hope this helps,</p>
<p>Stefan.</p>
<p>For more Web Code, ASP.NET, SQL Server and other development tips, please check back here at webcodeblog.com often.</p>
<br />Filed under: <a href='http://webcodeblog.com/category/net/'>.NET</a>, <a href='http://webcodeblog.com/category/visual-studio/'>Visual Studio</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webcodeblog.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webcodeblog.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webcodeblog.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webcodeblog.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webcodeblog.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webcodeblog.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webcodeblog.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webcodeblog.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webcodeblog.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webcodeblog.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webcodeblog.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webcodeblog.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webcodeblog.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webcodeblog.wordpress.com/191/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=191&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webcodeblog.com/2010/11/17/click-once-application-error-the-signers-certificate-is-not-valid-for-signing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/699d1b9d00561bf0dcf5b2a7a24f171e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stefanzv</media:title>
		</media:content>

		<media:content url="http://webcodeblog.files.wordpress.com/2010/11/createtestcertificate.jpg?w=300" medium="image">
			<media:title type="html">Create Test Certificate</media:title>
		</media:content>
	</item>
		<item>
		<title>Replacing all instances of a piece of text inside a SQL Server Database</title>
		<link>http://webcodeblog.com/2010/11/12/replacing-all-instances-of-a-piece-of-test-inside-sql-server-database/</link>
		<comments>http://webcodeblog.com/2010/11/12/replacing-all-instances-of-a-piece-of-test-inside-sql-server-database/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 07:01:40 +0000</pubDate>
		<dc:creator>Stefan Zvonar</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://webcodeblog.com/?p=183</guid>
		<description><![CDATA[So, have you ever had to replace a piece of text wherever it occured inside a SQL Server Database (without knowing where to even look)?  This can be a time consuming task, especially if you have a database with hundreds of tables and columns. I had to perform this recently when a server moved to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=183&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So, have you ever had to replace a piece of text wherever it occured inside a SQL Server Database (without knowing where to even look)?  This can be a time consuming task, especially if you have a database with hundreds of tables and columns.</p>
<p>I had to perform this recently when a server moved to a new domain (changing all usernames etc).</p>
<p>Here is how you can make a quick start.  What this article will explain is how to generate the script which you can then use to perform the alteration (although of course you will need to review the resultant script, change it, test it and run at your own risk!)</p>
<p>First, open SQL Server Management Studio and connect to your database, creating a blank query window.  You will need to also click on the &#8220;Results to Text&#8221; button, like shown below.</p>
<div id="attachment_185" class="wp-caption aligncenter" style="width: 310px"><a href="http://webcodeblog.files.wordpress.com/2010/11/1.jpg"><img class="size-medium wp-image-185" title="Results to text" src="http://webcodeblog.files.wordpress.com/2010/11/1.jpg?w=300&h=117" alt="Results to text" width="300" height="117" /></a><p class="wp-caption-text">Results to text</p></div>
<p>Now copy and paste the below script into your new query window.  This script will perform the script generation, replacing all instances of &#8216;ABC&#8217; with &#8216;XYZ&#8217;.  Here is where you change what string you are wanting to replace with its new value.</p>
<pre><span style="color:#000000;">    </span><span style="color:#0000ff;">SET</span><span style="color:#000000;"> </span><span style="color:#0000ff;">NOCOUNT</span><span style="color:#000000;"> </span><span style="color:#0000ff;">ON
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">DECLARE</span><span style="color:#000000;"> @SearchStr </span><span style="color:#0000ff;">varchar</span><span style="color:#808080;">(</span><span style="color:#000000;">100</span><span style="color:#808080;">)
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">DECLARE</span><span style="color:#000000;"> @ReplaceStr </span><span style="color:#0000ff;">varchar</span><span style="color:#808080;">(</span><span style="color:#000000;">100</span><span style="color:#808080;">)
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">SET</span><span style="color:#000000;"> @SearchStr </span><span style="color:#808080;">=</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'ABC'
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">SET</span><span style="color:#000000;"> @ReplaceStr </span><span style="color:#808080;">=</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'XYZ'

</span><span style="color:#000000;">    </span><span style="color:#0000ff;">DECLARE</span><span style="color:#000000;"> @TableName </span><span style="color:#0000ff;">nvarchar</span><span style="color:#808080;">(</span><span style="color:#000000;">256</span><span style="color:#808080;">),</span><span style="color:#000000;"> @ColumnName </span><span style="color:#0000ff;">nvarchar</span><span style="color:#808080;">(</span><span style="color:#000000;">128</span><span style="color:#808080;">),</span><span style="color:#000000;"> @Counter </span><span style="color:#0000ff;">int</span><span style="color:#808080;">,</span><span style="color:#000000;"> @Exists </span><span style="color:#0000ff;">int
</span><span style="color:#000000;">
    </span><span style="color:#0000ff;">SET</span><span style="color:#000000;"> @TableName </span><span style="color:#808080;">=</span><span style="color:#000000;"> </span><span style="color:#ff0000;">''
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">SET</span><span style="color:#000000;"> @Counter </span><span style="color:#808080;">=</span><span style="color:#000000;"> 0

    </span><span style="color:#0000ff;">CREATE</span><span style="color:#000000;"> </span><span style="color:#0000ff;">TABLE</span><span style="color:#000000;"> #StringFound
    </span><span style="color:#808080;">(
</span><span style="color:#000000;">     occurances </span><span style="color:#0000ff;">varchar</span><span style="color:#808080;">(</span><span style="color:#000000;">1000</span><span style="color:#808080;">),
</span><span style="color:#000000;">     tableName </span><span style="color:#0000ff;">varchar</span><span style="color:#808080;">(</span><span style="color:#000000;">1000</span><span style="color:#808080;">),
</span><span style="color:#000000;">     columnName </span><span style="color:#0000ff;">varchar</span><span style="color:#808080;">(</span><span style="color:#000000;">1000</span><span style="color:#808080;">)
</span><span style="color:#000000;">    </span><span style="color:#808080;">)
</span><span style="color:#000000;">
    </span><span style="color:#0000ff;">WHILE</span><span style="color:#000000;"> @TableName </span><span style="color:#808080;">IS</span><span style="color:#000000;"> </span><span style="color:#808080;">NOT</span><span style="color:#000000;"> </span><span style="color:#808080;">NULL
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">BEGIN
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">SET</span><span style="color:#000000;"> @ColumnName </span><span style="color:#808080;">=</span><span style="color:#000000;"> </span><span style="color:#ff0000;">''
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">SET</span><span style="color:#000000;"> @TableName </span><span style="color:#808080;">=</span><span style="color:#000000;">
        </span><span style="color:#808080;">(
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">SELECT</span><span style="color:#000000;"> </span><span style="color:#ff00ff;">MIN</span><span style="color:#808080;">(</span><span style="color:#ff00ff;">QUOTENAME</span><span style="color:#808080;">(</span><span style="color:#000000;">TABLE_SCHEMA</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'.'</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff00ff;">QUOTENAME</span><span style="color:#808080;">(</span><span style="color:#000000;">TABLE_NAME</span><span style="color:#808080;">))
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">FROM</span><span style="color:#000000;">     </span><span style="color:#008000;">INFORMATION_SCHEMA.TABLES
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">WHERE</span><span style="color:#000000;">         TABLE_TYPE </span><span style="color:#808080;">=</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'BASE TABLE'
</span><span style="color:#000000;">                </span><span style="color:#808080;">AND</span><span style="color:#000000;">    </span><span style="color:#ff00ff;">QUOTENAME</span><span style="color:#808080;">(</span><span style="color:#000000;">TABLE_SCHEMA</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'.'</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff00ff;">QUOTENAME</span><span style="color:#808080;">(</span><span style="color:#000000;">TABLE_NAME</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#808080;">&gt;</span><span style="color:#000000;"> @TableName
                </span><span style="color:#808080;">AND</span><span style="color:#000000;">    </span><span style="color:#ff00ff;">OBJECTPROPERTY</span><span style="color:#808080;">(
</span><span style="color:#000000;">                        </span><span style="color:#ff00ff;">OBJECT_ID</span><span style="color:#808080;">(
</span><span style="color:#000000;">                            </span><span style="color:#ff00ff;">QUOTENAME</span><span style="color:#808080;">(</span><span style="color:#000000;">TABLE_SCHEMA</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'.'</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff00ff;">QUOTENAME</span><span style="color:#808080;">(</span><span style="color:#000000;">TABLE_NAME</span><span style="color:#808080;">)
</span><span style="color:#000000;">                             </span><span style="color:#808080;">),</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'IsMSShipped'
</span><span style="color:#000000;">                               </span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#808080;">=</span><span style="color:#000000;"> 0
        </span><span style="color:#808080;">)

</span><span style="color:#000000;">        </span><span style="color:#0000ff;">WHILE</span><span style="color:#000000;"> </span><span style="color:#808080;">(</span><span style="color:#000000;">@TableName </span><span style="color:#808080;">IS</span><span style="color:#000000;"> </span><span style="color:#808080;">NOT</span><span style="color:#000000;"> </span><span style="color:#808080;">NULL)</span><span style="color:#000000;"> </span><span style="color:#808080;">AND</span><span style="color:#000000;"> </span><span style="color:#808080;">(</span><span style="color:#000000;">@ColumnName </span><span style="color:#808080;">IS</span><span style="color:#000000;"> </span><span style="color:#808080;">NOT</span><span style="color:#000000;"> </span><span style="color:#808080;">NULL)
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">BEGIN
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">SET</span><span style="color:#000000;"> @ColumnName </span><span style="color:#808080;">=
</span><span style="color:#000000;">            </span><span style="color:#808080;">(
</span><span style="color:#000000;">                </span><span style="color:#0000ff;">SELECT</span><span style="color:#000000;"> </span><span style="color:#ff00ff;">MIN</span><span style="color:#808080;">(</span><span style="color:#ff00ff;">QUOTENAME</span><span style="color:#808080;">(</span><span style="color:#000000;">COLUMN_NAME</span><span style="color:#808080;">))
</span><span style="color:#000000;">                </span><span style="color:#0000ff;">FROM</span><span style="color:#000000;">     </span><span style="color:#008000;">INFORMATION_SCHEMA.COLUMNS
</span><span style="color:#000000;">                </span><span style="color:#0000ff;">WHERE</span><span style="color:#000000;">         TABLE_SCHEMA    </span><span style="color:#808080;">=</span><span style="color:#000000;"> </span><span style="color:#ff00ff;">PARSENAME</span><span style="color:#808080;">(</span><span style="color:#000000;">@TableName</span><span style="color:#808080;">,</span><span style="color:#000000;"> 2</span><span style="color:#808080;">)
</span><span style="color:#000000;">                    </span><span style="color:#808080;">AND</span><span style="color:#000000;">    TABLE_NAME    </span><span style="color:#808080;">=</span><span style="color:#000000;"> </span><span style="color:#ff00ff;">PARSENAME</span><span style="color:#808080;">(</span><span style="color:#000000;">@TableName</span><span style="color:#808080;">,</span><span style="color:#000000;"> 1</span><span style="color:#808080;">)
</span><span style="color:#000000;">                    </span><span style="color:#808080;">AND</span><span style="color:#000000;">    DATA_TYPE </span><span style="color:#808080;">IN</span><span style="color:#000000;"> </span><span style="color:#808080;">(</span><span style="color:#ff0000;">'char'</span><span style="color:#808080;">,</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'varchar'</span><span style="color:#808080;">,</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'nchar'</span><span style="color:#808080;">,</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'nvarchar'</span><span style="color:#808080;">)
</span><span style="color:#000000;">                    </span><span style="color:#808080;">AND</span><span style="color:#000000;">    </span><span style="color:#ff00ff;">QUOTENAME</span><span style="color:#808080;">(</span><span style="color:#000000;">COLUMN_NAME</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#808080;">&gt;</span><span style="color:#000000;"> @ColumnName
            </span><span style="color:#808080;">)
</span><span style="color:#000000;">
            </span><span style="color:#0000ff;">IF</span><span style="color:#000000;"> @ColumnName </span><span style="color:#808080;">IS</span><span style="color:#000000;"> </span><span style="color:#808080;">NOT</span><span style="color:#000000;"> </span><span style="color:#808080;">NULL
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">BEGIN
</span><span style="color:#000000;">
                </span><span style="color:#0000ff;">INSERT</span><span style="color:#000000;"> </span><span style="color:#0000ff;">INTO</span><span style="color:#000000;"> #StringFound </span><span style="color:#0000ff;">EXEC</span><span style="color:#000000;"> </span><span style="color:#808080;">(</span><span style="color:#ff0000;">'SELECT COUNT(*), '''</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> @TableName </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff0000;">''', '''</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> @ColumnName </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'''  FROM '</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> @TableName </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff0000;">' WHERE '</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> @ColumnName </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff0000;">' LIKE ''%'</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> @SearchStr </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'%'' HAVING COUNT(*) &gt; 0'</span><span style="color:#808080;">)
</span><span style="color:#000000;">                </span><span style="color:#0000ff;">SET</span><span style="color:#000000;"> @Counter </span><span style="color:#808080;">=</span><span style="color:#000000;"> @Counter </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff00ff;">@@ROWCOUNT

</span><span style="color:#000000;">            </span><span style="color:#0000ff;">END
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">END</span><span style="color:#000000;">
    </span><span style="color:#0000ff;">END

</span><span style="color:#000000;">    </span><span style="color:#0000ff;">SELECT</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'EXEC sp_MSforeachtable ''ALTER TABLE ? DISABLE TRIGGER ALL'''

</span><span style="color:#000000;">    </span><span style="color:#0000ff;">SELECT</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'UPDATE ['</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff00ff;">DB_NAME</span><span style="color:#808080;">()</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'].'</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> tableName </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#0000ff;">CHAR</span><span style="color:#808080;">(</span><span style="color:#000000;">13</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#0000ff;">CHAR</span><span style="color:#808080;">(</span><span style="color:#000000;">10</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#808080;">+
</span><span style="color:#000000;">           </span><span style="color:#ff0000;">'SET '</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> columnName </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff0000;">' = REPLACE('</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> columnName </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff0000;">', '''</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> @SearchStr </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff0000;">''', '''</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> @ReplaceStr </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#ff0000;">''')'</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#0000ff;">CHAR</span><span style="color:#808080;">(</span><span style="color:#000000;">13</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#0000ff;">CHAR</span><span style="color:#808080;">(</span><span style="color:#000000;">10</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#808080;">+
</span><span style="color:#000000;">           </span><span style="color:#ff0000;">'GO'</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#0000ff;">CHAR</span><span style="color:#808080;">(</span><span style="color:#000000;">13</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#0000ff;">CHAR</span><span style="color:#808080;">(</span><span style="color:#000000;">10</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#0000ff;">CHAR</span><span style="color:#808080;">(</span><span style="color:#000000;">13</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#808080;">+</span><span style="color:#000000;"> </span><span style="color:#0000ff;">CHAR</span><span style="color:#808080;">(</span><span style="color:#000000;">10</span><span style="color:#808080;">)
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">FROM</span><span style="color:#000000;"> #StringFound
    </span><span style="color:#0000ff;">ORDER</span><span style="color:#000000;"> </span><span style="color:#0000ff;">BY</span><span style="color:#000000;"> tableName</span><span style="color:#808080;">,</span><span style="color:#000000;"> columnName

    </span><span style="color:#0000ff;">SELECT</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'EXEC sp_MSforeachtable ''ALTER TABLE ? ENABLE TRIGGER ALL'''

</span><span style="color:#000000;">    </span><span style="color:#0000ff;">DROP</span><span style="color:#000000;"> </span><span style="color:#0000ff;">TABLE</span><span style="color:#000000;"> #StringFound

    </span><span style="color:#008000;">--PRINT CAST(@Counter AS varchar) + ' occurence(s)'

</span><span style="color:#000000;">    </span><span style="color:#0000ff;">SET</span><span style="color:#000000;"> </span><span style="color:#0000ff;">NOCOUNT</span><span style="color:#000000;"> </span><span style="color:#0000ff;">OFF</span></pre>
<p>Simply execute the query and view the results.  Here is an example of the output script:</p>
<pre><span style="color:#000000;">----------------------------------------------------------
EXEC sp_MSforeachtable 'ALTER TABLE ? DISABLE TRIGGER ALL'

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
UPDATE [TEMP_DATABASE].[dbo].[SIMPLE_NAME]
SET [FIRST_NAME] = REPLACE([FIRST_NAME], 'ABC', 'XYZ')
GO

UPDATE [TEMP_DATABASE].[dbo].[SIMPLE_NAME]
SET [LAST_NAME] = REPLACE([LAST_NAME], 'ABC', 'XYZ')
GO

UPDATE [TEMP_DATABASE].[dbo].[SIMPLE_NAME]
SET [USERNAME] = REPLACE([USERNAME], 'ABC', 'XYZ')
GO

---------------------------------------------------------
EXEC sp_MSforeachtable 'ALTER TABLE ? ENABLE TRIGGER ALL'
</span></pre>
<p>As stated previously, never run this straight onto your database without testing and verifying the results.  You will also probably want to fine tune the script so that its updates are more precise (adding in WHERE clauses to keep the changes more precise).  However, this should give you a good place to start and see what tables and columns you need to look for!</p>
<p>Hope this helps,</p>
<p>Stefan.</p>
<p>For more Web Code, ASP.NET, SQL Server and other development tips, please check back here at webcodeblog.com often.﻿</p>
<br />Filed under: <a href='http://webcodeblog.com/category/sql-server/'>SQL Server</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webcodeblog.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webcodeblog.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webcodeblog.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webcodeblog.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webcodeblog.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webcodeblog.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webcodeblog.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webcodeblog.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webcodeblog.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webcodeblog.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webcodeblog.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webcodeblog.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webcodeblog.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webcodeblog.wordpress.com/183/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=183&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webcodeblog.com/2010/11/12/replacing-all-instances-of-a-piece-of-test-inside-sql-server-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/699d1b9d00561bf0dcf5b2a7a24f171e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stefanzv</media:title>
		</media:content>

		<media:content url="http://webcodeblog.files.wordpress.com/2010/11/1.jpg?w=300" medium="image">
			<media:title type="html">Results to text</media:title>
		</media:content>
	</item>
		<item>
		<title>Disable all triggers for a database</title>
		<link>http://webcodeblog.com/2010/10/04/disable-all-triggers-for-a-database/</link>
		<comments>http://webcodeblog.com/2010/10/04/disable-all-triggers-for-a-database/#comments</comments>
		<pubDate>Mon, 04 Oct 2010 00:42:49 +0000</pubDate>
		<dc:creator>Stefan Zvonar</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://webcodeblog.com/?p=180</guid>
		<description><![CDATA[Here is a nice little bit of T-SQL that will help with your scripting woes. Ever wanted to disable all triggers in a database so you can merrily import or merge data and other such tasks? Well here is what you can do, it simply disables all triggers for all tables in your active database [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=180&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here is a nice little bit of T-SQL that will help with your scripting woes.</p>
<p>Ever wanted to disable all triggers in a database so you can merrily import or merge data and other such tasks?</p>
<p>Well here is what you can do, it simply disables all triggers for all tables in your active database and then enables them again at the end of your changes.</p>
<pre><span style="color:#000000;">
</span><span style="color:#008000;">----------------------------------------------------------
</span><span style="color:#0000ff;">EXEC</span><span style="color:#000000;"> </span><span style="color:#800000;">sp_MSforeachtable</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'ALTER TABLE ? DISABLE TRIGGER ALL'
</span><span style="color:#008000;">----------------------------------------------------------

-- Write some SQL Modifications here

---------------------------------------------------------
</span><span style="color:#0000ff;">EXEC</span><span style="color:#000000;"> </span><span style="color:#800000;">sp_MSforeachtable</span><span style="color:#000000;"> </span><span style="color:#ff0000;">'ALTER TABLE ? ENABLE TRIGGER ALL'
</span><span style="color:#008000;">---------------------------------------------------------
</span></pre>
<p>Hope this helps,</p>
<p>Stefan.</p>
<p>For more Web Code, ASP.NET, SQL Server and other development tips, please check back here at webcodeblog.com often.</p>
<br />Filed under: <a href='http://webcodeblog.com/category/sql-server/'>SQL Server</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webcodeblog.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webcodeblog.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webcodeblog.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webcodeblog.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webcodeblog.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webcodeblog.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webcodeblog.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webcodeblog.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webcodeblog.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webcodeblog.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webcodeblog.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webcodeblog.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webcodeblog.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webcodeblog.wordpress.com/180/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=180&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webcodeblog.com/2010/10/04/disable-all-triggers-for-a-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/699d1b9d00561bf0dcf5b2a7a24f171e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stefanzv</media:title>
		</media:content>
	</item>
		<item>
		<title>Save and retrieve images / documents into SQL Server using ASP.NET</title>
		<link>http://webcodeblog.com/2010/08/22/save-and-retrieve-images-documents-into-sql-server-using-asp-net/</link>
		<comments>http://webcodeblog.com/2010/08/22/save-and-retrieve-images-documents-into-sql-server-using-asp-net/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 09:16:19 +0000</pubDate>
		<dc:creator>Stefan Zvonar</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://webcodeblog.com/?p=164</guid>
		<description><![CDATA[In this article I will explain how to save and retrieve VARBINARY(MAX) data into SQL Server using ASP.NET.  You may opt to do this to store images or documents into the database. So, let us start at the database level.  Below is a simplistic table definition for storing our files into a table: CREATE TABLE [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=164&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this article I will explain how to save and retrieve VARBINARY(MAX) data into SQL Server using ASP.NET.  You may opt to do this to store images or documents into the database.</p>
<p>So, let us start at the database level.  Below is a simplistic table definition for storing our files into a table:</p>
<pre><span style="color:#0000ff;">CREATE</span><span style="color:#000000;"> </span><span style="color:#0000ff;">TABLE</span><span style="color:#000000;"> [dbo]</span><span style="color:#808080;">.</span><span style="color:#000000;">[tb_File]</span><span style="color:#808080;">(
</span><span style="color:#000000;">    [FileID] [int] </span><span style="color:#0000ff;">IDENTITY</span><span style="color:#808080;">(</span><span style="color:#000000;">1</span><span style="color:#808080;">,</span><span style="color:#000000;">1</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#808080;">NOT</span><span style="color:#000000;"> </span><span style="color:#808080;">NULL,
</span><span style="color:#000000;">    [FileName] [varchar]</span><span style="color:#808080;">(</span><span style="color:#000000;">255</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#808080;">NOT</span><span style="color:#000000;"> </span><span style="color:#808080;">NULL,
</span><span style="color:#000000;">    [FileData] [varbinary]</span><span style="color:#808080;">(</span><span style="color:#ff00ff;">max</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#808080;">NOT</span><span style="color:#000000;"> </span><span style="color:#808080;">NULL,
</span><span style="color:#000000;">    [FileContentType] [varchar]</span><span style="color:#808080;">(</span><span style="color:#000000;">255</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#808080;">NOT</span><span style="color:#000000;"> </span><span style="color:#808080;">NULL,
</span><span style="color:#000000;"> </span><span style="color:#0000ff;">CONSTRAINT</span><span style="color:#000000;"> [PK_TB_FILE] </span><span style="color:#0000ff;">PRIMARY</span><span style="color:#000000;"> </span><span style="color:#0000ff;">KEY</span><span style="color:#000000;"> </span><span style="color:#0000ff;">CLUSTERED</span><span style="color:#000000;">
</span><span style="color:#808080;">(
</span><span style="color:#000000;">    [FileID] </span><span style="color:#0000ff;">ASC
</span><span style="color:#808080;">)</span><span style="color:#0000ff;">WITH</span><span style="color:#000000;"> </span><span style="color:#808080;">(</span><span style="color:#0000ff;">PAD_INDEX</span><span style="color:#000000;">  </span><span style="color:#808080;">=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">OFF</span><span style="color:#808080;">,</span><span style="color:#000000;"> </span><span style="color:#0000ff;">STATISTICS_NORECOMPUTE</span><span style="color:#000000;">  </span><span style="color:#808080;">=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">OFF</span><span style="color:#808080;">,</span><span style="color:#000000;"> </span><span style="color:#0000ff;">IGNORE_DUP_KEY</span><span style="color:#000000;"> </span><span style="color:#808080;">=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">OFF</span><span style="color:#808080;">,</span><span style="color:#000000;"> </span><span style="color:#0000ff;">ALLOW_ROW_LOCKS</span><span style="color:#000000;">  </span><span style="color:#808080;">=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">ON</span><span style="color:#808080;">,</span><span style="color:#000000;"> </span><span style="color:#0000ff;">ALLOW_PAGE_LOCKS</span><span style="color:#000000;">  </span><span style="color:#808080;">=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">ON</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#0000ff;">ON</span><span style="color:#000000;"> [PRIMARY]
</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#0000ff;">ON</span><span style="color:#000000;"> [PRIMARY]

GO

</span></pre>
<p>And here are two simple stored procedures to save and retrieve the file data:</p>
<pre><span style="color:#0000ff;">CREATE</span><span style="color:#000000;"> </span><span style="color:#0000ff;">PROCEDURE</span><span style="color:#000000;"> dbo</span><span style="color:#808080;">.</span><span style="color:#000000;">usp_File_Get
</span><span style="color:#808080;">(
</span><span style="color:#000000;">     @FileID </span><span style="color:#0000ff;">int
</span><span style="color:#808080;">)

</span><span style="color:#0000ff;">AS

BEGIN

</span><span style="color:#000000;">    </span><span style="color:#0000ff;">SET</span><span style="color:#000000;"> </span><span style="color:#0000ff;">NOCOUNT</span><span style="color:#000000;"> </span><span style="color:#0000ff;">ON

</span><span style="color:#000000;">    </span><span style="color:#0000ff;">SELECT</span><span style="color:#000000;"> FileID
      </span><span style="color:#808080;">,</span><span style="color:#000000;">[FileName]
      </span><span style="color:#808080;">,</span><span style="color:#000000;">FileData
      </span><span style="color:#808080;">,</span><span style="color:#000000;">FileContentType
  </span><span style="color:#0000ff;">  FROM</span><span style="color:#000000;"> tb_File
    </span><span style="color:#0000ff;">WHERE</span><span style="color:#000000;"> FileID </span><span style="color:#808080;">=</span><span style="color:#000000;"> @FileID

<pre><span style="color:#000000;"> </span><span style="color:#0000ff;">  SET</span><span style="color:#000000;"> </span><span style="color:#0000ff;">NOCOUNT</span><span style="color:#000000;"> </span><span style="color:#0000ff;">OFF</span></pre>
<p></span><span style="color:#0000ff;">END<br />
</span><span style="color:#000000;">GO</span><br />
And</p>
<pre><span style="color:#0000ff;">CREATE</span><span style="color:#000000;"> </span><span style="color:#0000ff;">PROCEDURE</span><span style="color:#000000;"> dbo</span><span style="color:#808080;">.</span><span style="color:#000000;">usp_File_Insert
</span><span style="color:#808080;">(</span><span style="color:#000000;"> </span><span style="color:#808080;">
</span><span style="color:#000000;">     @FileName </span><span style="color:#0000ff;">varchar</span><span style="color:#808080;">(</span><span style="color:#000000;">255</span><span style="color:#808080;">),
</span><span style="color:#000000;">     @FileData </span><span style="color:#0000ff;">varbinary</span><span style="color:#808080;">(</span><span style="color:#ff00ff;">max</span><span style="color:#808080;">),
</span><span style="color:#000000;">     @FileContentType </span><span style="color:#0000ff;">varchar</span><span style="color:#808080;">(</span><span style="color:#000000;">255</span><span style="color:#808080;">)
)

</span><span style="color:#0000ff;">AS

BEGIN

</span><span style="color:#000000;">    </span><span style="color:#0000ff;">SET</span><span style="color:#000000;"> </span><span style="color:#0000ff;">NOCOUNT</span><span style="color:#000000;"> </span><span style="color:#0000ff;">ON
</span><span style="color:#000000;"> </span><span style="color:#0000ff;"> </span><span style="color:#808080;">
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">INSERT</span><span style="color:#000000;"> </span><span style="color:#0000ff;">INTO</span><span style="color:#000000;"> tb_File </span><span style="color:#808080;">(</span><span style="color:#000000;">[FileName]</span><span style="color:#808080;">,</span><span style="color:#000000;"> FileData</span><span style="color:#808080;">,</span><span style="color:#000000;"> FileContentType</span><span style="color:#808080;">)</span><span style="color:#000000;">
    </span><span style="color:#0000ff;">VALUES</span><span style="color:#000000;"> </span><span style="color:#808080;">(</span><span style="color:#000000;">@FileName</span><span style="color:#808080;">,</span><span style="color:#000000;"> @FileData</span><span style="color:#808080;">,</span><span style="color:#000000;"> @FileContentType</span><span style="color:#808080;">)</span><span style="color:#000000;"> </span><span style="color:#000000;">

<pre><span style="color:#000000;">    </span><span style="color:#0000ff;">SET</span><span style="color:#000000;"> </span><span style="color:#0000ff;">NOCOUNT</span><span style="color:#000000;"> </span><span style="color:#0000ff;">OFF</span></pre>
<p></span><span style="color:#0000ff;">END<br />
</span><span style="color:#000000;">GO</span><br />
Now that we have the database objects in place, lets create a basic maintenance web page to be able to upload a file and save it to the database:</p>
<p><em>Markup:</em></p>
<pre><span style="color:#000000;">&lt;%</span><span style="color:#0000ff;">@</span><span style="color:#000000;"> </span><span style="color:#a31515;">Page</span><span style="color:#000000;"> </span><span style="color:#ff0000;">Language</span><span style="color:#0000ff;">="VB"</span><span style="color:#000000;"> </span><span style="color:#ff0000;">AutoEventWireup</span><span style="color:#0000ff;">="false"</span><span style="color:#000000;"> </span><span style="color:#ff0000;">CodeFile</span><span style="color:#0000ff;">="Default.aspx.vb"</span><span style="color:#000000;"> </span><span style="color:#ff0000;">Inherits</span><span style="color:#0000ff;">="_Default"</span><span style="color:#000000;"> %&gt;
</span><span style="color:#0000ff;">&lt;!</span><span style="color:#a31515;">DOCTYPE</span><span style="color:#000000;"> </span><span style="color:#ff0000;">html</span><span style="color:#000000;"> </span><span style="color:#ff0000;">PUBLIC</span><span style="color:#000000;"> </span><span style="color:#0000ff;">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span><span style="color:#000000;"> </span><span style="color:#0000ff;">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;</span><span style="color:#a31515;">html</span><span style="color:#000000;"> </span><span style="color:#ff0000;">xmlns</span><span style="color:#0000ff;">="http://www.w3.org/1999/xhtml"&gt;
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">head</span><span style="color:#000000;"> </span><span style="color:#ff0000;">runat</span><span style="color:#0000ff;">="server"&gt;
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">title</span><span style="color:#0000ff;">&gt;</span><span style="color:#000000;">Upload file to database</span><span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">title</span><span style="color:#0000ff;">&gt;
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">head</span><span style="color:#0000ff;">&gt;
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">body</span><span style="color:#0000ff;">&gt;
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">form</span><span style="color:#000000;"> </span><span style="color:#ff0000;">id</span><span style="color:#0000ff;">="form1"</span><span style="color:#000000;"> </span><span style="color:#ff0000;">runat</span><span style="color:#0000ff;">="server"&gt;
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">div</span><span style="color:#0000ff;">&gt;
</span><span style="color:#000000;">                File Name:
            </span><span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">div</span><span style="color:#0000ff;">&gt;
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">div</span><span style="color:#0000ff;">&gt;
</span><span style="color:#000000;">                </span><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:#0000ff;">:</span><span style="color:#a31515;">TextBox</span><span style="color:#000000;"> </span><span style="color:#ff0000;">runat</span><span style="color:#0000ff;">="server"</span><span style="color:#000000;"> </span><span style="color:#ff0000;">ID</span><span style="color:#0000ff;">="txtFileName"&gt;&lt;/</span><span style="color:#a31515;">asp</span><span style="color:#0000ff;">:</span><span style="color:#a31515;">TextBox</span><span style="color:#0000ff;">&gt;
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">div</span><span style="color:#0000ff;">&gt;
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">br</span><span style="color:#000000;"> </span><span style="color:#0000ff;">/&gt;
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">div</span><span style="color:#0000ff;">&gt;
</span><span style="color:#000000;">                File:
            </span><span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">div</span><span style="color:#0000ff;">&gt;
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">div</span><span style="color:#0000ff;">&gt;
</span><span style="color:#000000;">                </span><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:#0000ff;">:</span><span style="color:#a31515;">fileupload</span><span style="color:#000000;"> </span><span style="color:#ff0000;">runat</span><span style="color:#0000ff;">="server"</span><span style="color:#000000;"> </span><span style="color:#ff0000;">id</span><span style="color:#0000ff;">="uplFile"</span><span style="color:#000000;"> </span><span style="color:#0000ff;">/&gt;
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">div</span><span style="color:#0000ff;">&gt;
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">br</span><span style="color:#000000;"> </span><span style="color:#0000ff;">/&gt;
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">div</span><span style="color:#0000ff;">&gt;
</span><span style="color:#000000;">                </span><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:#0000ff;">:</span><span style="color:#a31515;">button</span><span style="color:#000000;"> </span><span style="color:#ff0000;">ID</span><span style="color:#0000ff;">="btnSave"</span><span style="color:#000000;"> </span><span style="color:#ff0000;">runat</span><span style="color:#0000ff;">="server"</span><span style="color:#000000;"> </span><span style="color:#ff0000;">text</span><span style="color:#0000ff;">="Save"</span><span style="color:#000000;"> </span><span style="color:#ff0000;">OnClick</span><span style="color:#0000ff;">="btnSave_Click"</span><span style="color:#000000;"> </span><span style="color:#0000ff;">/&gt;
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">div</span><span style="color:#0000ff;">&gt;
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">form</span><span style="color:#0000ff;">&gt;
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">body</span><span style="color:#0000ff;">&gt;
&lt;/</span><span style="color:#a31515;">html</span><span style="color:#0000ff;">&gt;</span></pre>
<p><em>Code-Behind:</em></p>
<pre><span style="color:#000000;"> </span><span style="color:#0000ff;">Partial</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Class</span><span style="color:#000000;"> _Default
    </span><span style="color:#0000ff;">Inherits</span><span style="color:#000000;"> System.Web.UI.Page

    </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> m_strFileName, m_strFileContentType </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">String
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> m_intFileLen </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Integer
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> m_byteFileData </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Byte</span><span style="color:#000000;">()

    </span><span style="color:#0000ff;">Protected</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub</span><span style="color:#000000;"> btnSave_Click(</span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> sender </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Object</span><span style="color:#000000;">, </span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> e </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> EventArgs)

        GetFileData()
        SaveData()

    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub

</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub</span><span style="color:#000000;"> GetFileData()

        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> myFile </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> HttpPostedFile = uplFile.PostedFile
        m_strFileName = System.IO.Path.GetFileName(uplFile.FileName)
        m_strFileContentType = myFile.ContentType
        m_intFileLen = myFile.ContentLength
        m_byteFileData = </span><span style="color:#0000ff;">Nothing

</span><span style="color:#000000;">        </span><span style="color:#008000;">' make sure the size of the file is &gt; 0
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">If</span><span style="color:#000000;"> m_intFileLen &gt; 0 </span><span style="color:#0000ff;">Then
</span><span style="color:#000000;">            </span><span style="color:#008000;">' Allocate a buffer for reading of the file
</span><span style="color:#000000;">            m_byteFileData = </span><span style="color:#0000ff;">New</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Byte</span><span style="color:#000000;">(m_intFileLen - 1) {}

            </span><span style="color:#008000;">' Read uploaded file from the Stream
</span><span style="color:#000000;">            myFile.InputStream.Read(m_byteFileData, 0, m_intFileLen)

        </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">If

</span><span style="color:#000000;">    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub

</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub</span><span style="color:#000000;"> SaveData()

        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> conSQL = </span><span style="color:#0000ff;">New</span><span style="color:#000000;"> SqlClient.SqlConnection
        conSQL.ConnectionString = </span><span style="color:#a31515;">"Your database connection string"
</span><span style="color:#000000;">        conSQL.Open()

        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> comSQL </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">New</span><span style="color:#000000;"> SqlClient.SqlCommand()

        </span><span style="color:#0000ff;">With</span><span style="color:#000000;"> comSQL

            .CommandText = </span><span style="color:#a31515;">"dbo.usp_File_Insert"
</span><span style="color:#000000;">            .Connection = conSQL
            .CommandType = CommandType.StoredProcedure
            .Parameters.AddWithValue(</span><span style="color:#a31515;">"@FileName"</span><span style="color:#000000;">, m_strFileName)

            .Parameters.Add(</span><span style="color:#a31515;">"@DocData"</span><span style="color:#000000;">, SqlDbType.VarBinary, -1)   </span><span style="color:#008000;">' Need to set size to -1 since it is varbinary(max)
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">If</span><span style="color:#000000;"> m_byteFileData </span><span style="color:#0000ff;">Is</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Nothing</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Then
</span><span style="color:#000000;">                .Parameters(</span><span style="color:#a31515;">"@DocData"</span><span style="color:#000000;">).Value = System.DBNull.Value
            </span><span style="color:#0000ff;">Else
</span><span style="color:#000000;">                .Parameters(</span><span style="color:#a31515;">"@DocData"</span><span style="color:#000000;">).Value = m_byteFileData
            </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">If

</span><span style="color:#000000;">            .Parameters.AddWithValue(</span><span style="color:#a31515;">"@DocContentType"</span><span style="color:#000000;">, m_strFileContentType)
            .ExecuteNonQuery()
        </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">With

</span><span style="color:#000000;">        conSQL.Close()
        conSQL.Dispose()

    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub

End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Class

</span></pre>
<p>Now lets look at how we can view the stored binary data through ASP.NET.  Below we have a simple handler that is passed a File ID as a Querystring.  It will look up the ID in the database and then write the object out as a byte stream.</p>
<pre><span style="color:#000000;">&lt;%</span><span style="color:#0000ff;">@</span><span style="color:#000000;"> </span><span style="color:#a31515;">WebHandler</span><span style="color:#000000;"> </span><span style="color:#ff0000;">Language</span><span style="color:#0000ff;">="VB"</span><span style="color:#000000;"> </span><span style="color:#ff0000;">Class</span><span style="color:#0000ff;">="FileHandler"</span><span style="color:#000000;"> %&gt;</span></pre>
<pre><span style="color:#0000ff;">Imports</span><span style="color:#000000;"> System
</span><span style="color:#0000ff;">Imports</span><span style="color:#000000;"> System.Web
</span><span style="color:#0000ff;">Imports</span><span style="color:#000000;"> System.Web.Services

</span><span style="color:#0000ff;">Public</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Class</span><span style="color:#000000;"> FileHandler
    </span><span style="color:#0000ff;">Implements</span><span style="color:#000000;"> System.Web.IHttpHandler

    </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> m_strFileContentType </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">String</span><span style="color:#000000;"> = </span><span style="color:#0000ff;">String</span><span style="color:#000000;">.Empty
    </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> m_objFileData </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Object
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> m_intFileID </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Integer

</span><span style="color:#0000ff;">    ReadOnly</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Property</span><span style="color:#000000;"> IsReusable() </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Boolean</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Implements</span><span style="color:#000000;"> IHttpHandler.IsReusable
        </span><span style="color:#0000ff;">Get
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">Return</span><span style="color:#000000;"> </span><span style="color:#0000ff;">False
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Get
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Property

</span><span style="color:#0000ff;">
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Sub</span><span style="color:#000000;"> ProcessRequest(</span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> context </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> HttpContext) </span><span style="color:#0000ff;">Implements</span><span style="color:#000000;"> IHttpHandler.ProcessRequest

        GetData(context)
        ShowFile(context)

    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub

</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub</span><span style="color:#000000;"> GetData(</span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> context </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> HttpContext)

        </span><span style="color:#0000ff;">If</span><span style="color:#000000;"> context.Request.QueryString(</span><span style="color:#a31515;">"ID"</span><span style="color:#000000;">) </span><span style="color:#0000ff;">IsNot</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Nothing</span><span style="color:#000000;"> </span><span style="color:#0000ff;">AndAlso</span><span style="color:#000000;"> context.Request.QueryString(</span><span style="color:#a31515;">"ID"</span><span style="color:#000000;">).Trim() &lt;&gt; </span><span style="color:#0000ff;">String</span><span style="color:#000000;">.Empty </span><span style="color:#0000ff;">AndAlso</span><span style="color:#000000;"> IsNumeric(context.Request.QueryString(</span><span style="color:#a31515;">"ID"</span><span style="color:#000000;">).Trim()) </span><span style="color:#0000ff;">Then
</span><span style="color:#000000;">            m_intFileID = </span><span style="color:#0000ff;">CInt</span><span style="color:#000000;">(context.Request.QueryString(</span><span style="color:#a31515;">"ID"</span><span style="color:#000000;">).Trim())

            </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> conSQL = </span><span style="color:#0000ff;">New</span><span style="color:#000000;"> SqlClient.SqlConnection
            conSQL.ConnectionString = </span><span style="color:#a31515;">"Your database connection string"
</span><span style="color:#000000;">            conSQL.Open()

            </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> comSQL </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">New</span><span style="color:#000000;"> SqlCommand(</span><span style="color:#a31515;">"dbo.usp_File_Get"</span><span style="color:#000000;">)
</span>            comSQL.Connection = conSQL
<span style="color:#000000;">            comSQL.Parameters.AddWithValue(</span><span style="color:#a31515;">"@FileID"</span><span style="color:#000000;">, m_intFileID)
            comSQL.CommandType = CommandType.StoredProcedure
</span>
<span style="color:#000000;">            </span><span style="color:#008000;">'read record from database
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> drdDrillInstructions </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> SqlDataReader
            drdDrillInstructions = comSQL.ExecuteReader()
            </span><span style="color:#0000ff;">Try
</span><span style="color:#000000;">                </span><span style="color:#0000ff;">If</span><span style="color:#000000;"> (drdDrillInstructions.HasRows) </span><span style="color:#0000ff;">Then
</span><span style="color:#000000;">                    </span><span style="color:#0000ff;">While</span><span style="color:#000000;"> drdDrillInstructions.Read()
                        m_strFileContentType = drdDrillInstructions.Item(</span><span style="color:#a31515;">"FileContentType"</span><span style="color:#000000;">).ToString()
                        m_objFileData = drdDrillInstructions.Item(</span><span style="color:#a31515;">"FileData"</span><span style="color:#000000;">)
                    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">While
</span><span style="color:#000000;">                </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">If
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">Catch</span><span style="color:#000000;"> ex </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> Exception
                </span><span style="color:#008000;">' Publish error here
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">Finally
</span><span style="color:#000000;">                </span><span style="color:#0000ff;">If</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Not</span><span style="color:#000000;"> drdDrillInstructions.IsClosed </span><span style="color:#0000ff;">Then
</span><span style="color:#000000;">                    drdDrillInstructions.Close()
                </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">If
</span>                conSQL.Close()
                conSQL.Dispose()
<span style="color:#000000;">            </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Try
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">If

</span><span style="color:#000000;">    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub

</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub</span><span style="color:#000000;"> ShowFile(</span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> context </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> HttpContext)

        </span><span style="color:#008000;">' Clear out the existing HTTP header information
</span><span style="color:#000000;">        context.Response.Expires = 0
        context.Response.Buffer = </span><span style="color:#0000ff;">True
</span><span style="color:#000000;">        context.Response.Clear()

        </span><span style="color:#0000ff;">If</span><span style="color:#000000;"> m_objFileData </span><span style="color:#0000ff;">IsNot</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Nothing</span><span style="color:#000000;"> </span><span style="color:#0000ff;">AndAlso</span><span style="color:#000000;"> (</span><span style="color:#0000ff;">Not</span><span style="color:#000000;"> DBNull.Value.Equals(m_objFileData)) </span><span style="color:#0000ff;">Then
</span><span style="color:#000000;">            context.Response.ContentType = m_strFileContentType
            context.Response.BinaryWrite(</span><span style="color:#0000ff;">DirectCast</span><span style="color:#000000;">(m_objFileData, </span><span style="color:#0000ff;">Byte</span><span style="color:#000000;">()))
        </span><span style="color:#0000ff;">Else
</span><span style="color:#000000;">            context.Response.Write(</span><span style="color:#a31515;">"&lt;html&gt;&lt;body bgcolor='#D6EBFF'&gt;&lt;p align='center'&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;"</span><span style="color:#000000;">)
            context.Response.Write(</span><span style="color:#a31515;">"&lt;font class='text'&gt;(No file available)&lt;/font&gt;"</span><span style="color:#000000;">)
            context.Response.Write(</span><span style="color:#a31515;">"&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;"</span><span style="color:#000000;">)
        </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">If

</span><span style="color:#000000;">    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub

End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Class

</span></pre>
<p>Hope this helps,</p>
<p>Stefan.</p>
<p>For more Web Code, ASP.NET, SQL Server and other development tips, please check back here at webcodeblog.com often.</p>
<br />Filed under: <a href='http://webcodeblog.com/category/net/'>.NET</a>, <a href='http://webcodeblog.com/category/net/asp-net/'>ASP.NET</a>, <a href='http://webcodeblog.com/category/sql-server/'>SQL Server</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webcodeblog.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webcodeblog.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webcodeblog.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webcodeblog.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webcodeblog.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webcodeblog.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webcodeblog.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webcodeblog.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webcodeblog.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webcodeblog.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webcodeblog.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webcodeblog.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webcodeblog.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webcodeblog.wordpress.com/164/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webcodeblog.com&#038;blog=12806740&#038;post=164&#038;subd=webcodeblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webcodeblog.com/2010/08/22/save-and-retrieve-images-documents-into-sql-server-using-asp-net/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/699d1b9d00561bf0dcf5b2a7a24f171e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stefanzv</media:title>
		</media:content>
	</item>
	</channel>
</rss>
