INTRODUCTION AND RELEVANT INFORMATION:
I have an
MS Access 2007
database with a table that has
string
field and
numerical
one. The
numerical
field is of type
double
and can be negative or positive.
I use
ADO
to connect to the database and load its data into
edit
controls with
SetDialogItemText
API-edit controls are in the
dialog box
.
User can edit the values of existing data ( when saving changes I get data from
edit
controls with
GetDialogItemText
API ).
PROBLEM:
Everything works fine in my program
if the user has English or US locale, but if the user selects European locale then my
ADO string
is incorrect and reports error.
This is expected since in the English version it has 2 parameters-
string
and a
double
but since Europeans use comma as a decimal point ( for example US
123.456
is
123,456
)
ADO
interprets it as having 3 parameters instead of two-for example:
INSERT INTO table VALUES ( 'some string', 12.5 );
INSERT INTO table VALUES ( 'some string', 12,5 );
To explain more thoroughly:
Let us say that we have loaded data from database into
edit
controls using European locale:
First one holds
string
(
Some string
) and second one decimal number (
123,456
).
Let us say user changes the string value into
Some other string
and presses the
Save button
.
Now my code gets values from
edit
controls but the error must occur since I got
123,456
from the second edit control (
remember, user left decimal data unchanged ), and my
ADO string
is not properly configured since now it looks like this:
INSERT INTO table VALUES ( 'Some other string', 123,456 );
MY QUESTION:
If the user has set the European locale, is there a way to load decimal values from
MS Access 2007 database
into
edit
control
with comma changed into dot?
Or maybe I can somehow
subclass edit
control to change comma into dot?
User input can be limited to dot and letters by
sublclassing
the
edit
control so that is not the problem. I just want to load data from database properly, so my
ADO string
can be executed without error if user decides
not to edit decimal data like in the example I described above.
Thank you.
Best regards.