Last post Dec 09, 2015 01:06 PM by deadtroll
Dec 08, 2015 02:12 AM|bvpavan|LINK
I have a class with decimal and other data types.
it looks fine when i check the json data in web browser.
Decimal datatype is getting changed after downloading the data from API to my desktop application..
Example: 6.35732543013259E17 to 6.3584758782805E+17
i getting conversion exception while inserting the data to DB.
Please help me how to fix this ??
Dec 08, 2015 03:18 PM|DeadTroll|LINK
use format provider and culture in decimal.tryparse
Dec 08, 2015 06:23 PM|bvpavan|LINK
Thanks for your response deadtroll
it worked partially.. :(
Actual Value is 635847587827330400 was converted to 6.3584758782733E+17
with CultureInfo i got the output as 635847587827330000
Dec 09, 2015 01:06 PM|DeadTroll|LINK
What converted it to 6.5xxxx, if your input was with 0400 then the conversion would have kept it.
Dim d As Decimal
Dim c As New CultureInfo("en-US")
d = Decimal.Parse("635847587827330400", NumberStyles.Any, c)
Label1.Text = d.ToString
the label text is "635847587827330400"
Post your code, something your doing isnt correct.