In the US, you use a "." as the separator, but in Germany you use a ",". I'm trying to test whether my logic is smart enough to handle either one but I seem to be failing to put my Windows 2000 machine into German mode.
I went to Control Panel, Regional Options, and changed "Your locale" to "Germany". I then restarted both IIS and SQL Server. But my changes don't seem to have taken effect.
These lines still show "." to be the separator.
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo( System.Threading.Thread.CurrentThread.CurrentCulture.Name);
Response.Write(ci.NumberFormat.NumberDecimalSeparator);
What am I doing wrong?
The best way to test this is to add a globalization element to your web.config, e.g.:
<system.web>
<globalization culture="de-DE" uiCulture="en-US" />
</system.web>
Changing culture to de-DE will affect date and numeric formats: you could also change uiCulture if you want, leaving uiCulture as en-US means you will get exception messages in US English.
When you set your Regional Settings, did you make sure to "Apply all settings to the current user account and to the default user profile" (Advanced tab) ?
That should do it in most cases. I'm also assuming that your culture is not preset to "en-us" in the globalization
element of Web.config
.
It appears that you don't want to do it by setting your Culture settings manually in code, rather you want them inherited by System settings. That, IMO, is a good way of checking since your changes should be propagated to SQL server as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With