Click here to Skip to main content
12,510,860 members (59,726 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: LINQ MySQL
I have seven decimal fields in my table.I want all values sum.If I am adding normally like val = (i.val1+ i.val2+.. i.val7).I am getting the value only if all fields are not null,if any of these fields are the value is displaying as null.can u tell me how to do this.
Posted 8-Nov-12 22:21pm
Comments
digimanus 9-Nov-12 11:05am
   
are the i.valx nullables? if yes then val = i.val1 ?? 0 + i.val2 ?? 0...and so on
Greysontyrus 15-Nov-12 5:58am
   
I'd rate that as an answer, digimanus
digimanus 12-Nov-12 4:37am
   
is your question solved ?

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

@Greysontyrus like this?

are the i.valx nullables? if yes then val = i.val1 ?? 0 + i.val2 ?? 0...and so on
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160929.1 | Last Updated 15 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100