Click here to Skip to main content
15,900,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all !!!
Now i get max money by using this code:

newRow.ToAmount = 922337203685477.5807M;

In db ToAmount is money type. I am using table entity.
when i update value max decimal . it shows error
Posted
Updated 5-Dec-13 23:14pm
v2
Comments
Simon_Whale 6-Dec-13 5:52am    
What is newRow? is this a class? or dataTable?
what type is ToAmount? is it decimal or float etc?

1 solution

You should use:
C#
newRow.ToAmount = Decimal.MaxValue;

instead.


You may refer to money and smallmoney (Transact-SQL)[^].

Indeed it is stated that money type ranges from -922,337,203,685,477.5808 to 922,337,203,685,477.5807.
So your initial statement seems to be correct (i.e. this value is included in the valid range for a money type).
 
Share this answer
 
v2
Comments
baotdinh 6-Dec-13 4:39am    
I have tried but it errors : Arithmetic overflow error for type money
phil.o 6-Dec-13 4:45am    
The informations you provided are insufficient to help you solve your problem.
I suspect there is a database involved, and some query on it; but I don't like to guess :)
Please improve your question and show some more code involved (specificly of which type is the newRow variable? ; and what is the type of its ToAmout property?)
Do not post code in a comment; click on the Improve question button.

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