Regional Settings
-
I am trying to write a program that sends data from a DataTable to an Microsoft Access Database (mdb format) using an OleDBConnection. The regional settings of my computer are set to "Greek". The problem is that the decimal numbers stored in the datatable cannot be transferred correctly to the Access Database. For example, the numer 15.34 (where "." is the decimal point for the US Regional Settings) is stored as 15.340,00 (where "," is the decimal point for the Greek Regional Settings). I have tried to set the regional settings from inside the source code (using the CurrentThread.CultureInfo to "Greek") but that only applies to System.String values, and NOT decimal or floating point. For this reason, the values cannot be stored correctly into the Access DB file. The only way to correct this problem is to manually change the regional settings from the Control Panel, but I would like to avoid this solution. I would appreciate it if you could help me with this issue. Thank you in advance... Dimitris A.
-
I am trying to write a program that sends data from a DataTable to an Microsoft Access Database (mdb format) using an OleDBConnection. The regional settings of my computer are set to "Greek". The problem is that the decimal numbers stored in the datatable cannot be transferred correctly to the Access Database. For example, the numer 15.34 (where "." is the decimal point for the US Regional Settings) is stored as 15.340,00 (where "," is the decimal point for the Greek Regional Settings). I have tried to set the regional settings from inside the source code (using the CurrentThread.CultureInfo to "Greek") but that only applies to System.String values, and NOT decimal or floating point. For this reason, the values cannot be stored correctly into the Access DB file. The only way to correct this problem is to manually change the regional settings from the Control Panel, but I would like to avoid this solution. I would appreciate it if you could help me with this issue. Thank you in advance... Dimitris A.
I had a similar problem some weeks ago using MSDE. I was storing dates using DateTime.ToLongDateString() and DateTime.ToShortTimeString(), but I found out that it generated an exception on systems where Windows was localized to Spanish (dates in Mexico are DD/MM/YYYY as oppossed to MM/DD/YYYY). What I did was to manually construct the date string using DateTime properties (Month, Day and so on) and it worked well on both my English development machine and those in Spanish where it was tested. But I did not find a more elegant way to do this. -- LuisR ────────────── Luis Alonso Ramos Chihuahua, Mexico www.luisalonsoramos.com "Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
-
I had a similar problem some weeks ago using MSDE. I was storing dates using DateTime.ToLongDateString() and DateTime.ToShortTimeString(), but I found out that it generated an exception on systems where Windows was localized to Spanish (dates in Mexico are DD/MM/YYYY as oppossed to MM/DD/YYYY). What I did was to manually construct the date string using DateTime properties (Month, Day and so on) and it worked well on both my English development machine and those in Spanish where it was tested. But I did not find a more elegant way to do this. -- LuisR ────────────── Luis Alonso Ramos Chihuahua, Mexico www.luisalonsoramos.com "Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
You can just format the date using an ANSI standard format (YYYY-MM-DD), I've never found a system/regional setting that doesn't understand that one correctly. Contract Software Developer: andrew_lewis@mail.com