Changing currency format from danish to English. RRS feed

  • Question

  • User-1395992131 posted

    I have problem in localizing currency value in asp.net

    The idea is that I want to display the currency value for the Danish (da-DK) culture and the same value will be store in DB as english format . I am using NumberFormatInfo to change to currency for the selected culture.


    if I select Danish (da-DK) ,the currency value is 100.000,56

    I want to store the value in Database is that 100000.56

    The code is below.

    TextBox1.Text = 100.000,56;

    double dblDBvalue ;

    dblDBvalue=Convert.ToDouble(TextBox1.Text.ToString() == "" ? "0" : TextBox1.Text.ToString(),NumberFormatInfo.InvariantInfo );

    This code is giving throw error, when I want to convert from Danish to englsh.

    thanks in advance.

    Wednesday, September 26, 2012 9:05 AM


  • User-14045634 posted

    The format of a number or currency should be determined on the frontend (web or desktop application), rather than on the database.

    Store your currency value as money type in SQL Server, and then display it on your web page using the appropriate culture formatter.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 26, 2012 9:59 AM