开发者

insert comma in decimal type

开发者 https://www.devze.com 2023-02-19 20:47 出处:网络
I Want to insert A comma into 开发者_高级运维adecimal type how i can do it ?Replace it with a dot.

I Want to insert A comma into 开发者_高级运维adecimal type how i can do it ?


Replace it with a dot.

insert  YourTable
        (DecimalColumn)
select  replace('3,14',',','.')


This might be your answer - Formatting Numbers as Strings with Commas in place of Decimals

The top answer there is:

  string.Format(System.Globalization.CultureInfo.GetCultureInfo("de-DE"), "{0:0.0}", 4.3);


Decimal representation is completely depends on culture. So you need to provide appropriate culture during convertion, like in code below:

        double test = 8888.33;
        MessageBox.Show(string.Format(System.Globalization.CultureInfo.GetCultureInfo("EN-US"),"{0:0,0.0}",test));
0

精彩评论

暂无评论...
验证码 换一张
取 消