Click here to Skip to main content
15,844,498 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
My SQL DB has US culture settings but I'm based in EU.
In my gridview $ and mdy date format is shown ( also . and , are swapped in numbers).
Can I set the EU formats on these fields somehow?

setting the culture to nl-BE in my website does not help.

thank you for your help.

How can it possibly currency setting affect database server operation. You should store numbers, not strings representing numbers, no matter is that currency of not. And numbers, by their nature, are culture-neutral. You need to take care of the presentation of the numbers in ASP.NET, and set the threads to required cultures.

Actually, MySQL does have culture-related settings, but it's mostly related to the calendar:[^][^].

Also note that dollars remain dollars even if they are written in different culture. It all depends on what you calculate. If you only calculate the currency of only one kind, you don't even need to carry information on what the units are. And if you do operate with different currency units, the real issue is the (ever changing) rates.

It's not clear how "setting the culture to nl-BE in my website does not help". How come? Of course it does help, but the culture comes into play when you format number for showing them on screen. Please see:[^],[^].

If you do it, you will see that numeric data formatting is affected by the culture choice. Please see all the ToString methods of the numeric type(s) you use.
See also:[^],[^].

This is how you get your currency symbol:[^].

This way, your application can be globalized. You don't have to hard-code dollar or euro characters, you can set current culture as required and get the default currency symbol.

Share this answer
[no name] 7-Nov-14 17:55pm    
I'll take this. Thank you, my small 5. Bruno
Sergey Alexandrovich Kryukov 7-Nov-14 19:11pm    
Thank you, Bruno.
Eddy Sels 8-Nov-14 11:12am    
I will read all the links you mention. Thank you for that.
But be aware in MS SQL database you can have a field with type 'smallmoney'.
the data returned is culture dependent. I don't know why this is or which culture setting prevails (database server, web server). In any case not the web site because then I would not have the issue.
I tested my site in Azure where I did not have the issue because the servers have a culture which matches my own. Since I went live on a US based webhosting my currency, number and date formats are in the US culture.

I tried the ToString but sometimes (I haven't figured out why) I get an error in VS2013 saying ToString has no overload which takes 3 arguments.
BTW I use numbers not strings.
Sergey Alexandrovich Kryukov 8-Nov-14 21:39pm    
Good. As to ToString, just check up the signatures you can use. You try to use non-existing one.
I was setting the culture in my code, but the culture was not set. I modified the code and now it is ok. So it was a bug in my code.
I figured it out by adding a label on my start page with the current culture info.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900