Convert To Double

前端 未结 3 1185
太阳男子
太阳男子 2021-01-29 05:54

Ok im sitting with this issue kind of stupid but I don\'t know how to google this for the solution.

Lets say i have a database with values inside e.g 1000.00

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-29 06:50

    This is because of your CultureInfo. Apparently, your PC is using periods for decimal notation, while your server is using commas. if you try to convert one of them using the other method, you get this issue.

    Solution: Convert.ToDouble() has an extra overload which allows you to pass a cultureInfo for conversion. Or you can just save your variable in the database as a float or decimal.

提交回复
热议问题