Page 1 of 1

error with non-standard number formatting

Posted: Fri 13 Jan 2006 13:15
by Guest
Hello,

I get a strange error.
I modify my regional settings,
select English(United States) for Standards and Formats,
click on "customize",
on "Numbers" tab change Decimal symbol to "," (comma) and Digit grouping symbol to " " (space),
on "Currency" tab change Decimal symbol to "," (comma) and Digit grouping symbol to "." (period),
apply settings,
start your demo: "Query.exe" and open the query: "select cast(1234/100 as numeric(15,3))"
the result shown to me is 12000.
Thats wrong. With default settings, the correct result 12 is shown.

The error only occurs for numeric columns.

I used last Version 3.55.2.22, I tried Delphi 5 and Delphi 7 (German Version).

Is it an Sdac Error or a Delphi error?

Thanks for your help.

Posted: Mon 16 Jan 2006 13:47
by Ikar
We couldn't reproduce the problem.

Try to execute following sequence:

bcd, bcd2: TBcd;

bcd := DoubleToBcd(12.34);
NormalizeBcd(bcd, bcd2, 15, 3);
Caption := BcdToStr(bcd2);

error with non-standard number formatting

Posted: Tue 17 Jan 2006 13:08
by Guest
Hello,

the result in Delphi 7 is: 12,34

in Delphi 5 I am not able to compile it.

Posted: Tue 17 Jan 2006 13:40
by Andreas Heinrich
Hello,

Please notice that the error only occurs with exact these regional settings English(United States):

on "Numbers" tab change Decimal symbol to "," (comma) and Digit grouping symbol to " " (space), and
on "Currency" tab change Decimal symbol to "," (comma) and Digit grouping symbol to "." (period).

A query with default ADO components result in 12 (ok).
The same query with Sdac components result in 12000 (!).

Posted: Thu 19 Jan 2006 15:21
by Ikar
If Field DataType property is ftFloat and regional settings modified as you said, the Microsoft OLEDB Provider for MS SQL Server returns incorrect field value. To avoid this problem you can set EnableBCD property to True. ADO components fetchs this value as decimal but not as float. That's why you get correct value using ADO.

Posted: Mon 23 Jan 2006 08:50
by Andreas Heinrich
Hello,

Thank you, with EnableBCD = True it works as expected.