Skip to content

More Christmas Nuggets

December 15, 2015

Once again following on from Christmas Nuggets #8, this is obviously a very easy solution to the problem but can be overseen or overlooked.

The result of the expression is always ‘true’ since a value of type ‘decimal’ is never equal to ‘null’ of type ‘decimal’
if (ObjectInfo.Price != null)
{
    query = query + “Price = ‘” + ObjectInfo.Price + “‘,”;
}

Here you very obviously need to just remove the If statement, and it will work as you cannot compare null values on a decimal variable or similarly an int variable.

Advertisements

From → Uncategorized

Leave a Comment

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

%d bloggers like this: