|
-
Aug 25th, 2010, 01:57 PM
#2
Re: How to use Nullable types?
Hey MarMan,
DBNull is not exactly the same as Null. Null really means that a reference-type variable has no reference while the DBNull value can also mean that a variable or a table field was never initialized, it represent the abscence of a known value. Its not a big difference but that's why you are getting the error you get. Have a look here for more info.
the simple solution is to use an "if" statement to check for DBNull value.
Last edited by stlaural; Aug 25th, 2010 at 02:03 PM.
Alex
.NET developer
"No. Not even in the face of Armageddon. Never compromise." (Walter Kovacs/Rorschach)
Things to consider before posting.
Don't forget to rate the posts if they helped and mark thread as resolved when they are.
.Net Regex Syntax (Scripting) | .Net Regex Language Element | .Net Regex Class | DateTime format | Framework 4.0: what's new
My fresh new blog : writingthecode, even if I don't post much.
System: Intel i7 920, Kingston SSDNow V100 64gig, HDD WD Caviar Black 1TB, External WD "My Book" 500GB, XFX Radeon 4890 XT 1GB, 12 GBs Tri-Channel RAM, 1x27" and 1x23" LCDs, Windows 10 x64, ]VS2015, Framework 3.5 and 4.0 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|