Strange numeric behavior

Re: Strange numeric behavior

Postby Antonio Linares » Sat Sep 21, 2013 7:08 pm

Enrico,

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

Code: Select all  Expand view
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: 41435
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Strange numeric behavior

Postby Antonio Linares » Sat Sep 21, 2013 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41435
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Strange numeric behavior

Postby Enrico Maria Giordano » Sat Sep 21, 2013 8:08 pm

Antonio,

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8381
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Strange numeric behavior

Postby Enrico Maria Giordano » Sat Sep 21, 2013 8:11 pm

I found these:

Code: Select all  Expand view
oCn:Properties( "Locale Identifier" ) = ...


or

Code: Select all  Expand view
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=MyDatabase.mdb;Locale Identifier=...


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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8381
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Strange numeric behavior

Postby Antonio Linares » Sat Sep 21, 2013 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41435
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Strange numeric behavior

Postby Enrico Maria Giordano » Sat Sep 21, 2013 9:19 pm

Antonio,

tried all flavors: no success. :-(

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8381
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Strange numeric behavior

Postby nageswaragunupudi » Sun Sep 22, 2013 2: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
User avatar
nageswaragunupudi
 
Posts: 10316
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Strange numeric behavior

Postby Enrico Maria Giordano » Sun Sep 22, 2013 3:02 pm

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8381
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 40 guests