Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
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
Comments
Herman<T>.Instance 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
Herman<T>.Instance 12-Nov-12 4:37am    
is your question solved ?

1 solution

@Greysontyrus like this?

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

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900