Implicity在c#.net中将类型'string'转换为'double' [英] Implicity Convert type 'string' to 'double' in c#.net

查看:195
本文介绍了Implicity在c#.net中将类型'string'转换为'double'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
我在javascript中使用计算,因此文本框值使用此调用codebehind



hi I am using calculation in javascript so textbox value calling codebehind using this

price=Convert.ToDouble(Request.Form[txtsaving.UniqueID]),





price数据类型在数据库中是float,类是double。

假设我的文本框值是 17.458686 然后来到c#转换值是 17458686.0



但我的问题是没有改变c#中的价值请给我一个解决方案......



谢谢

Ravinder



price datatype is float in database ,class is double .
suppose in my textbox value is 17.458686 then after coming to c# converting value is 17458686.0

but my question is not changing that value in c# please give me a solution....

Thanks
Ravinder

推荐答案

使用InvariantCulture

use InvariantCulture
price=Convert.ToDouble(Request.Form[txtsaving.UniqueID], System.Globalization.CultureInfo.InvariantCulture);





中讨论的相同问题如何正确地将带有decimalPoint的String转换为Double [ ^ ]


这篇关于Implicity在c#.net中将类型'string'转换为'double'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆