FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Strange numeric behavior
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Strange numeric behavior

Posted: Sat Sep 21, 2013 07:08 PM
Enrico,

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

Code (fw): Select all Collapse
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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Strange numeric behavior

Posted: Sat Sep 21, 2013 07:28 PM

This seems to be the message he is refering to:

PostMessage( HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0 )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: Strange numeric behavior

Posted: Sat Sep 21, 2013 08:08 PM

Antonio,

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

EMG

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: Strange numeric behavior

Posted: Sat Sep 21, 2013 08:11 PM
I found these:

Code (fw): Select all Collapse
oCn:Properties( "Locale Identifier" ) = ...


or

Code (fw): Select all Collapse
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=MyDatabase.mdb;Locale Identifier=...


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

EMG
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Strange numeric behavior

Posted: Sat Sep 21, 2013 08:31 PM
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
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: Strange numeric behavior

Posted: Sat Sep 21, 2013 09:19 PM

Antonio,

tried all flavors: no success. :-(

EMG

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Strange numeric behavior

Posted: Sun Sep 22, 2013 02:27 PM

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
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: Strange numeric behavior

Posted: Sun Sep 22, 2013 03:02 PM

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

EMG

Continue the discussion