问题:在本地转换数字没有问题但是发布到服务器报数据类型转换失败的信息.
答案:本地的语言版本和服务器语言版本不一样。
在web.config 中添加如下信息即可.
<system.web>
<globalization culture=”en-us” />
</system.web>
–转–
Link:
http://stackoverflow.com/questions/5275380/input-string-was-not-in-a-correct-format-2?answertab=active#tab-top
As far as I know the Convert
methods use the current locale to do such conversions. In this case I’d guess your current locale would expect a comma as decimal point. Try to set the current locale for your application or the conversion to some language/country where dots are used (e.g. en_US). The method should provide a second optional parameter to provide a IFormatProvider as an alternative solution.
简体中文(中国)
zh-cn
繁体中文(台湾地区)
zh-tw
繁体中文(香港)
zh-hk
英语(香港)
en-hk
英语(美国)
en-us
英语(英国)
en-gb
原文链接:https://www.cnblogs.com/konglingxing/p/5150513.html
原创文章,作者:优速盾-小U,如若转载,请注明出处:https://www.cdnb.net/bbs/archives/33015