Nullable Booleans – Very interesting…

As I started looking at LINQ, I’m running into some interesting scenarios regarding nullable boolean values. We all know how SQL allows for a BIT to be 3 values: True, False or NULL. We also know that in SQL, handling NULLs in comparisons requires special attention. For the most part NULL does not equal NULL.

The use of LINQ brings this concept and scenario up into the .NET programming world. Now I need to be careful about conditionals that include Nullable(Of Boolean).

I won’t repeat all the information here, but please read the following articles that explain this in good detail:

Nullable Types
http://msdn.microsoft.com/en-us/library/bb981315(VS.80).aspx

Using Nullable Types (C# Programming Guide)
http://msdn.microsoft.com/en-us/library/2cf62fcy.aspx

SQL-CLR Type Mismatches (LINQ to SQL)
http://msdn.microsoft.com/en-us/library/bb386909.aspx

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: