在.net多语言应用程序中保存和检索数值到数据库 [英] Saving And Retrieving numeric Values Into Database In .net Multilingual Application

查看:74
本文介绍了在.net多语言应用程序中保存和检索数值到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在研究.net多语言应用程序。我的问题是如何将数字/十进制值保存到数据库中,因为法语的小数分隔符为",","和美国的小数点分隔符为"。"。

I am working on a .net multilingual application. My problem is how to save numeric/decimal values into database because French has decimal separator as "," and US has decimal separator as ".".

请帮帮我。

谢谢&问候

Mahakar Singh Panwar

Mahakar Singh Panwar

 

 

推荐答案

在数据库中保存为int。

Save in database as int.

现在:

格式化数字数据特定文化

Formatting Numeric Data for a Specific Culture



NumberFormatInfo
类定义货币,小数分隔符和其他数字符号根据文化进行格式化和显示。例如,对于文化"en-US",十进制数10000.50被格式化为10,000.50。和文化$ 10.000,
" de-DE"。

The NumberFormatInfo class defines how currency, decimal separators, and other numeric symbols are formatted and displayed based on culture. For example, the decimal number 10000.50 is formatted as 10,000.50 for the culture "en-US" and 10.000,50 for the culture "de-DE".

可以为特定文化创建 NumberFormatInfo 的实例,或者不变的文化,但不是中立的文化。中性文化无法提供足够的信息来显示正确的数字格式。如果您尝试使用中性文化创建 NumberFormatInfo 的实例,则会抛出
异常。

An instance of NumberFormatInfo can be created for a specific culture, or the invariant culture, but not for a neutral culture. A neutral culture does not provide enough information to display the correct numeric format. An exception is thrown if you attempt to create an instance of NumberFormatInfo using a neutral culture.

以下代码示例使用<显示整数 NumberFormatInfo 指定
CurrentCulture 的标准货币格式(" c")。

The following code example displays an integer using the NumberFormatInfo standard currency format ("c") for the specified CurrentCulture.




这篇关于在.net多语言应用程序中保存和检索数值到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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