Click here to Skip to main content
Rate this: bad
good
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 23:21pm
Comments
digimanus at 9-Nov-12 11:05am
   
are the i.valx nullables? if yes then val = i.val1 ?? 0 + i.val2 ?? 0...and so on
Greysontyrus at 15-Nov-12 5:58am
   
I'd rate that as an answer, digimanus
digimanus at 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
0 OriginalGriff 7,215
1 DamithSL 5,114
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,747
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 15 Nov 2012
Copyright © CodeProject, 1999-2014
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