<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WebPaws.com &#187; VB.net</title>
	<atom:link href="http://webpaws.com/blog/web-development/web-design/vbnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://webpaws.com/blog</link>
	<description>Internet Marketing and Design Services for Turnkey Web Solutions</description>
	<lastBuildDate>Thu, 10 May 2012 02:17:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Conversion from type &#8216;DBNull&#8217; to type &#8216;String&#8217; is not valid</title>
		<link>http://webpaws.com/blog/108/conversion-from-type-dbnull-to-type-string-is-not-valid/</link>
		<comments>http://webpaws.com/blog/108/conversion-from-type-dbnull-to-type-string-is-not-valid/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 05:51:25 +0000</pubDate>
		<dc:creator>webpaws</dc:creator>
				<category><![CDATA[VB.net]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[DBNull]]></category>
		<category><![CDATA[net]]></category>
		<category><![CDATA[VB]]></category>

		<guid isPermaLink="false">http://webpaws.com/blog/?p=108</guid>
		<description><![CDATA[In a VB.net application, retrieving variables from a database, if the value was null, it would cause the error, &#8220;Conversion from type &#8216;DBNull&#8217; to type &#8216;String&#8217; is not valid&#8221;.  A work-around to stop this error was to create a function that would evaluate the imported database variable for a null value as an object then [&#8230;] <a class="more-link" href="http://webpaws.com/blog/108/conversion-from-type-dbnull-to-type-string-is-not-valid/">&#8595; Read the rest of this entry...</a><br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://webpaws.com/blog/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br /><p><a href="http://webpaws.com/blog/108/conversion-from-type-dbnull-to-type-string-is-not-valid/">Conversion from type &#8216;DBNull&#8217; to type &#8216;String&#8217; is not valid</a> is a post from: <a href="http://webpaws.com/blog">WebPaws.com</a></p>
]]></description>
			<content:encoded><![CDATA[<!--S-ButtonZ 1.1.5 Start--><!--S-ButtonZ 1.1.5 End--><div class="linkedin_share_container" style="float:right;margin:0px 0px 10px 10px"><a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwebpaws.com%2Fblog%2F108%2Fconversion-from-type-dbnull-to-type-string-is-not-valid%2F&amp;title=Conversion+from+type+%26%238216%3BDBNull%26%238217%3B+to+type+%26%238216%3BString%26%238217%3B+is+not+valid&amp;summary=In+a+VB.net+application%2C+retrieving+variables+from+a+database%2C+if+the+value+was+null%2C+it+would+cause+the+error%2C+%22Conversion+from+type+%27DBNull%27+to+type+%27String%27+is+not+valid%22.%C2%A0+A+work-around+to+stop+this+error+was+to+create+a+function+that+would+evaluate+the+imported+database+variable+for+a+null+value+as+an+object+then+%5B%26hellip%3B%5D+%3Ca+class%3D%22more-link%22+href%3D%22http%3A%2F%2Fwebpaws.com%2Fblog%2F108%2Fconversion-from-type-dbnull-to-type-string-is-not-valid%2F%22%3E%26darr%3B+Read+the+rest+of+this+entry...%3C%2Fa%3E&amp;source=WebPaws.com" onclick="return popupLinkedInShare(this.href,'console',400,570)" class="linkedin_share_button"><img src="http://webpaws.com/blog/wp-content/plugins/linkedin-share-button/buttons/01.png" alt="" /></a></div><p>In a VB.net application, retrieving variables from a database, if the value was null, it would cause the error, &#8220;Conversion from type &#8216;DBNull&#8217; to type &#8216;String&#8217; is not valid&#8221;.  A work-around to stop this error was to create a function that would evaluate the imported database variable for a null value as an object then convert it to a string for use without error in your code.</p>
<p>Here is the VB.net code:</p>
<p><code><br />
<span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">Function</span><span style="font-size: x-small;"> checkNull(</span><span style="color: #0000ff; font-size: x-small;">Byval</span><span style="font-size: x-small;"> variable </span><span style="color: #0000ff; font-size: x-small;">as</span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;">object</span><span style="font-size: x-small;">) </span><span style="color: #0000ff; font-size: x-small;">as</span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;">String<br />
</span><span style="color: #0000ff; font-size: x-small;"> If</span><span style="font-size: x-small;"> IsDBNull(varialbe) </span><span style="color: #0000ff; font-size: x-small;">Then<br />
</span><span style="color: #0000ff; font-size: x-small;"> Return</span><span style="font-size: x-small;">(</span><span style="color: #800000; font-size: x-small;">""</span><span style="font-size: x-small;">)<br />
</span><span style="color: #0000ff; font-size: x-small;"> Else<br />
</span><span style="color: #0000ff; font-size: x-small;"> Return</span><span style="font-size: x-small;"> </span><span style="font-size: x-small;">(variable)<br />
</span><span style="color: #0000ff; font-size: x-small;"> End</span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;">If<br />
</span><span style="color: #0000ff; font-size: x-small;">End</span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;">Function</span></span></span><br />
</code></p>
<br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://webpaws.com/blog/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br /><p><a href="http://webpaws.com/blog/108/conversion-from-type-dbnull-to-type-string-is-not-valid/">Conversion from type &#8216;DBNull&#8217; to type &#8216;String&#8217; is not valid</a> is a post from: <a href="http://webpaws.com/blog">WebPaws.com</a></p>
<div style="clear:both;">&nbsp;</div>
<div class="sociable">
<span class="sociable_tagline">
<strong>Take a piece of the Web from WebPaws.com:</strong>
	<span>These icons link to social bookmarking sites where readers can share and discover new web pages.</span>
</span>
<ul>
	<li><a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwebpaws.com%2Fblog%2F108%2Fconversion-from-type-dbnull-to-type-string-is-not-valid%2F" title="Facebook" rel="nofollow" target="_blank"><img src="http://webpaws.com/blog/wp-content/plugins/sociable-zyblog-edition/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwebpaws.com%2Fblog%2F108%2Fconversion-from-type-dbnull-to-type-string-is-not-valid%2F&amp;title=Conversion%20from%20type%20%27DBNull%27%20to%20type%20%27String%27%20is%20not%20valid&amp;source=WebPaws.com&amp;summary=EXCERPT" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://webpaws.com/blog/wp-content/plugins/sociable-zyblog-edition/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a href="http://twitter.com/home?status=http%3A%2F%2Fwebpaws.com%2Fblog%2F108%2Fconversion-from-type-dbnull-to-type-string-is-not-valid%2F" title="TwitThis" rel="nofollow" target="_blank"><img src="http://webpaws.com/blog/wp-content/plugins/sociable-zyblog-edition/images/twitter.png" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
	<li><a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwebpaws.com%2Fblog%2F108%2Fconversion-from-type-dbnull-to-type-string-is-not-valid%2F&amp;t=Conversion%20from%20type%20%27DBNull%27%20to%20type%20%27String%27%20is%20not%20valid" title="MySpace" rel="nofollow" target="_blank"><img src="http://webpaws.com/blog/wp-content/plugins/sociable-zyblog-edition/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwebpaws.com%2Fblog%2F108%2Fconversion-from-type-dbnull-to-type-string-is-not-valid%2F&amp;title=Conversion%20from%20type%20%27DBNull%27%20to%20type%20%27String%27%20is%20not%20valid" title="Google Bookmarks" rel="nofollow" target="_blank"><img src="http://webpaws.com/blog/wp-content/plugins/sociable-zyblog-edition/images/google.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a href="http://www.webnews.de/einstellen?url=http%3A%2F%2Fwebpaws.com%2Fblog%2F108%2Fconversion-from-type-dbnull-to-type-string-is-not-valid%2F&amp;title=Conversion%20from%20type%20%27DBNull%27%20to%20type%20%27String%27%20is%20not%20valid" title="Webnews" rel="nofollow" target="_blank"><img src="http://webpaws.com/blog/wp-content/plugins/sociable-zyblog-edition/images/webnews.png" title="Webnews" alt="Webnews" class="sociable-hovers" /></a></li>
	<li><a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwebpaws.com%2Fblog%2F108%2Fconversion-from-type-dbnull-to-type-string-is-not-valid%2F&amp;title=Conversion%20from%20type%20%27DBNull%27%20to%20type%20%27String%27%20is%20not%20valid" title="Digg" onfocus="sociable_description_link(this, 'bodytext')" rel="nofollow" target="_blank"><img src="http://webpaws.com/blog/wp-content/plugins/sociable-zyblog-edition/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a href="http://del.icio.us/post?url=http%3A%2F%2Fwebpaws.com%2Fblog%2F108%2Fconversion-from-type-dbnull-to-type-string-is-not-valid%2F&amp;title=Conversion%20from%20type%20%27DBNull%27%20to%20type%20%27String%27%20is%20not%20valid" title="del.icio.us" rel="nofollow" target="_blank"><img src="http://webpaws.com/blog/wp-content/plugins/sociable-zyblog-edition/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a href="http://www.stumbleupon.com/submit.php?url=http://webpaws.com/blog/108/conversion-from-type-dbnull-to-type-string-is-not-valid/" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://webpaws.com/blog/wp-content/plugins/sociable-zyblog-edition/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a href="http://www.ekudos.nl/artikel/nieuw?url=http%3A%2F%2Fwebpaws.com%2Fblog%2F108%2Fconversion-from-type-dbnull-to-type-string-is-not-valid%2F&amp;title=Conversion%20from%20type%20%27DBNull%27%20to%20type%20%27String%27%20is%20not%20valid" title="eKudos" rel="nofollow" target="_blank"><img src="http://webpaws.com/blog/wp-content/plugins/sociable-zyblog-edition/images/ekudos.png" title="eKudos" alt="eKudos" class="sociable-hovers" /></a></li>
	<li><a href="mailto:?subject=Conversion%20from%20type%20%27DBNull%27%20to%20type%20%27String%27%20is%20not%20valid&amp;body=http%3A%2F%2Fwebpaws.com%2Fblog%2F108%2Fconversion-from-type-dbnull-to-type-string-is-not-valid%2F" title="email" onfocus="sociable_description_link(this, 'E-mail this story to a friend!')" rel="nofollow" target="_blank"><img src="http://webpaws.com/blog/wp-content/plugins/sociable-zyblog-edition/images/email.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a href="http://extension.fleck.com/?v=b.0.804&amp;url=http%3A%2F%2Fwebpaws.com%2Fblog%2F108%2Fconversion-from-type-dbnull-to-type-string-is-not-valid%2F" title="Fleck" rel="nofollow" target="_blank"><img src="http://webpaws.com/blog/wp-content/plugins/sociable-zyblog-edition/images/fleck.gif" title="Fleck" alt="Fleck" class="sociable-hovers" /></a></li>
	<li><a href="http://hype.yeebase.com/submit/http%3A%2F%2Fwebpaws.com%2Fblog%2F108%2Fconversion-from-type-dbnull-to-type-string-is-not-valid%2F" title="Hype" rel="nofollow" target="_blank"><img src="http://webpaws.com/blog/wp-content/plugins/sociable-zyblog-edition/images/hype.png" title="Hype" alt="Hype" class="sociable-hovers" /></a></li>
	<li><a href="http://www.mister-wong.de/addurl/?bm_url=http%3A%2F%2Fwebpaws.com%2Fblog%2F108%2Fconversion-from-type-dbnull-to-type-string-is-not-valid%2F&amp;bm_description=Conversion%20from%20type%20%27DBNull%27%20to%20type%20%27String%27%20is%20not%20valid&amp;plugin=soc" title="MisterWong" rel="nofollow" target="_blank"><img src="http://webpaws.com/blog/wp-content/plugins/sociable-zyblog-edition/images/misterwong.png" title="MisterWong" alt="MisterWong" class="sociable-hovers" /></a></li>
	<li><a href="javascript:window.print();" title="Print" onfocus="sociable_description_link(this, 'Print this article!')" rel="nofollow" target="_blank"><img src="http://webpaws.com/blog/wp-content/plugins/sociable-zyblog-edition/images/printer.png" title="Print" alt="Print" class="sociable-hovers" /></a></li>
	<li><a href="http://technorati.com/faves?add=http%3A%2F%2Fwebpaws.com%2Fblog%2F108%2Fconversion-from-type-dbnull-to-type-string-is-not-valid%2F" title="Technorati" rel="nofollow" target="_blank"><img src="http://webpaws.com/blog/wp-content/plugins/sociable-zyblog-edition/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwebpaws.com%2Fblog%2F108%2Fconversion-from-type-dbnull-to-type-string-is-not-valid%2F&amp;=Conversion%20from%20type%20%27DBNull%27%20to%20type%20%27String%27%20is%20not%20valid" title="YahooMyWeb" rel="nofollow" target="_blank"><img src="http://webpaws.com/blog/wp-content/plugins/sociable-zyblog-edition/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
</ul>
</div>
<span class="facebook-like"><fb:like layout="box_count" show_faces="false" width="45" href="http://webpaws.com/blog/108/conversion-from-type-dbnull-to-type-string-is-not-valid/"></fb:like></span>]]></content:encoded>
			<wfw:commentRss>http://webpaws.com/blog/108/conversion-from-type-dbnull-to-type-string-is-not-valid/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

