Last post Sep 26, 2012 09:59 AM by stefano.tempesta
Sep 26, 2012 09:05 AM|King79|LINK
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.
Sep 26, 2012 09:59 AM|stefano.tempesta|LINK
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.