decimal separator, regional settings

  • Thread starter Thread starter pax
  • Start date Start date
P

pax

Hello there!

Here is my problem, in the simplest scenario:
- an Access 2000 format database (created with Access 2003)
- a simple table that contains one single field defined as Number, Decimal,
18,2
- VS2005 standard, C#
- a data source / dataset that cotains that simple Access table
- a DataGridView, created by drag and drop, with all the helper objects
(adapter, navigator etc) that edits that simple table
- WinXPSP2 with ***Regional Options in Control Panel set to
Romanian*** , with no other customization

And here's the problem: what magic do I have to do to enter decimal numbers
in that grid and save them in the database? Because as long as I type in
1,23 (given that the decimal separator in Romanian Regional Options is the
comma), the grid displays it correctly, I can save it to the daabase, but
when I reload the data by reopening the form, my number is 123 (and it
really IS 123 in the database!).

Thanks in advance.


pax
 
Pax on what computer is your database located and what is its regional
setting?

Cor
 
The database is local, it resides on the computer that the app is running
on.
Here are some other details:
- I first encountered this problem on user's computer, then I was able to
reproduce it on my machine by changing the regional settings to Romanian.
- I upgraded the database to the 2003 format, the problem persists. So it's
not that.
- I used some other control to edit the data, i.e. a simple textbox, still
the same, so it's not datagridview's fault.
- I created the same dummy table on SQL, then used another dataset, the
problem's gone, so it is related somehow to Access!
- used the:
Thread.CurrentThread.CurrentCulture = new CultureInfo("ro-RO");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("ro-RO");
(and also with 'false' as a second parameter, useUserOverride), of no
avail. The funny thing here is that on a machine with EN-US regional
settings and the above two lines in place, everything works fine!
- tried to set the Locale Identifier property on the connectionstring to
1048 (RO), no news.

So that's pretty much it, I'm out of any ideas...

Any help much appreciated.
Thanks a lot.


Pax
 
pax said:
Hello there!

Here is my problem, in the simplest scenario:
- an Access 2000 format database (created with Access 2003)
- a simple table that contains one single field defined as Number,
Decimal, 18,2
- VS2005 standard, C#
- a data source / dataset that cotains that simple Access table
- a DataGridView, created by drag and drop, with all the helper objects
(adapter, navigator etc) that edits that simple table
- WinXPSP2 with ***Regional Options in Control Panel set to
Romanian*** , with no other customization

And here's the problem: what magic do I have to do to enter decimal
numbers in that grid and save them in the database? Because as long as I
type in 1,23 (given that the decimal separator in Romanian Regional
Options is the comma), the grid displays it correctly, I can save it to
the daabase, but when I reload the data by reopening the form, my number
is 123 (and it really IS 123 in the database!).

Thanks in advance.


pax
 
And your access program is not a US one?

(including the Jet Engine). (MDAC updates)

Cor
 
Everything is US on my computer, Windows, VS2005, Access. There is no RO
component. You're telling me you cannot reproduce this? The simple table
with a Decimal (18,2), a dataset, drag&drop, a datagridview, then Regional
Settings to RO?
 
Pax,
Everything is US on my computer, Windows, VS2005, Access.

Something you tell now the first time, while reading your message I got the
idea it was certainly not a US setting because it was returning information
in US format, and that was what you did not expect.

I think it is better up to somebody else who understand this kind of logic
better to help you.

Cor
 
Sorry if I mislead you or if my logic seems twisted to you.
The entire 'setting' (i.e. the products - Windows, VS, MS-Access) on my
machine is US. All I'm trying to do is to make it work when the Regional
Settings in CP are changed to RO.
 
Let's call it a topic, Cor. Thank a lot. I tried to change the Decimal to
Double and the problem's gone. Another Microsoft bug. I'm sick of them.
This was the second bug that I encountered in an incredibly small project,
there are only 3 forms with basic tasks!!! The first bug was the Esc
(canceling) when inserting the first row in a datagridview. Crap!
Bugs in dev. environments and technologies! That's great! Let's LINQ, let's
3.0, let's XAML and whatnot! While they are not able to cover the most basic
scenarios! Technology, not business and models, is what MS keeps us
interested in. Decimal vs. Double, not architecture, object-relational and
the good stuff. Too bad there's already too much time since I'm doing it,
but maybe one fine morning I'll say: I've had enough, MS...

Cor, thanks for your interest.

Pax
 
Back
Top