Casting Decimal problem

W

William

Hello,

I have a very straingts problem about casting string to decimal.
When I Cast on mine developers box (Windows 2003 Webedition) string
12,73 the result of function FormatCurrency is €12,73

When I promoted the webappliction to the production box (Windows 2003
Enterprise edition) is the result of function FormatCurrency
€1.273,00 when I passed the string 12,73.

Have somebody a sollution about this problem?
I had already check the Regional settings, they are indentic on both
boxes.


public string FormatCurrency(string sPrice)
{
NumberFormatInfo nfi = new NumberFormatInfo();
nfi.CurrencyDecimalDigits = 2;
nfi.CurrencyDecimalSeparator = ",";
nfi.CurrencyGroupSeparator = ".";
int[] groups = new int[1];
groups[0] = 3;
nfi.CurrencyGroupSizes = groups;
nfi.CurrencySymbol = "€ ";
Decimal c = Convert.ToDecimal(sPrice) ;
return c.ToString("c", nfi);
}

Regards,

William
 
P

Patrice

Which settings have you checked ? ASP.NET uses those configured in the
web.config file, not those from the control panel...
--
Patrice

"William" <[email protected]> a écrit dans le message de
Hello,

I have a very straingts problem about casting string to decimal.
When I Cast on mine developers box (Windows 2003 Webedition) string
12,73 the result of function FormatCurrency is ?12,73

When I promoted the webappliction to the production box (Windows 2003
Enterprise edition) is the result of function FormatCurrency
?1.273,00 when I passed the string 12,73.

Have somebody a sollution about this problem?
I had already check the Regional settings, they are indentic on both
boxes.


public string FormatCurrency(string sPrice)
{
NumberFormatInfo nfi = new NumberFormatInfo();
nfi.CurrencyDecimalDigits = 2;
nfi.CurrencyDecimalSeparator = ",";
nfi.CurrencyGroupSeparator = ".";
int[] groups = new int[1];
groups[0] = 3;
nfi.CurrencyGroupSizes = groups;
nfi.CurrencySymbol = "? ";
Decimal c = Convert.ToDecimal(sPrice) ;
return c.ToString("c", nfi);
}

Regards,

William
 
Top