Strange numeric behavior

User avatar
Antonio Linares
Site Admin
Posts: 42660
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 69 times
Been thanked: 96 times
Contact:

Re: Strange numeric behavior

Post by Antonio Linares »

Enrico,

This may help:
http://objectmix.com/c/398307-setlocaleinfo-how-make-effect-immeadiate.html

Code: Select all | Expand

bool SetDecimalSeparator(char Separator)
{
bool blRetVal = true;
char * pDecSep = new char[2];

GetLocaleInfo(GetSystemDefaultLCID(),LOCALE_SDECIMAL,pDecSep,2);

if(Separator == '.' && pDecSep[0] != '.')
{
if(!SetLocaleInfo(GetSystemDefaultLCID(), LOCALE_SDECIMAL, "."))
{
// PostMessage ??
blRetVal = false;
}
}
else if(Separator == ',' && pDecSep[0] != ',')
{
if(!SetLocaleInfo(GetSystemDefaultLCID(), LOCALE_SDECIMAL, ","))
{
// PostMessage ??
blRetVal = false;
}
}

delete[] pDecSep;
return blRetVal;
}

//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
SetDecimalSeparator('.');

}
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42660
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 69 times
Been thanked: 96 times
Contact:

Re: Strange numeric behavior

Post by Antonio Linares »

This seems to be the message he is refering to:

PostMessage( HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0 )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 8770
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 7 times
Contact:

Re: Strange numeric behavior

Post by Enrico Maria Giordano »

Antonio,

it changes locale settings for all system. We surely don't want to do this. :-)

EMG
User avatar
Enrico Maria Giordano
Posts: 8770
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 7 times
Contact:

Re: Strange numeric behavior

Post by Enrico Maria Giordano »

I found these:

Code: Select all | Expand

oCn:Properties( "Locale Identifier" ) = ...


or

Code: Select all | Expand

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=MyDatabase.mdb;Locale Identifier=...


but I didn't get them to work. :-(

EMG
User avatar
Antonio Linares
Site Admin
Posts: 42660
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 69 times
Been thanked: 96 times
Contact:

Re: Strange numeric behavior

Post by Antonio Linares »

Enrico,

This may help:
http://embarcadero.newsgroups.archived.at/public.delphi.database.ado/201004/1004281248.html

What I remember is, all Properties.Value must be in "string mode", even if
it's integer.
Another thing that I've found in my code, using hexa mode.

Try this

1044 --> 0x00000414

AdoConnection.Properties['Locale Identifier'].Value := '0x00000414';

Same thing under the connection string

'...;Locale Identifier=0x00000414;...'
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 8770
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 7 times
Contact:

Re: Strange numeric behavior

Post by Enrico Maria Giordano »

Antonio,

tried all flavors: no success. :-(

EMG
User avatar
nageswaragunupudi
Posts: 10733
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 11 times
Contact:

Re: Strange numeric behavior

Post by nageswaragunupudi »

I changed decimal symbol to "," and tested.
I confirm the problem with mdb and accdb.

Jet and Ace handle dbf also. There is no problem with dbf but only with Access.

It is not Locale. Whatever be the locale, it is only the "," that is creating the problem
Regards

G. N. Rao.
Hyderabad, India
User avatar
Enrico Maria Giordano
Posts: 8770
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 7 times
Contact:

Re: Strange numeric behavior

Post by Enrico Maria Giordano »

I searched and searched Internet but found no solution... :-(

EMG
Post Reply