Problem fetching decimal(28, 15) with custom regional settings

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
nandod

Problem fetching decimal(28, 15) with custom regional settings

Post by nandod » Thu 09 Feb 2006 10:21

Hello,
here is the test case for a strange problem I am having with a customer's database.

Environment:
- Delphi v7 UP 1
- Windows XP Pro (Italian - shouldn't matter but who knows)
- CoreLab dbX driver for SQL Server v2.50
- SQL Server 2000
- MDAC v2.8 SP 1
- EnableBDC = False

Test case:
- create a table with a single decimal (28, 15) field
- insert a single record with the value 1
- do a select * from table thus loading the value in a TFloatField

You should get 1.

Now change the computer's regional settings this way:
- Base option set = English (United States)
- Customize -> Decimal sep = , (comma), thousand sep = . (dot)

Re-run the example and you'll see a value of 1E15.

A colleague of mine has confirmed that the problem persists with version 3.0 of the dbX driver. I can see that it's OLE DB that's returning rubbish in the record buffer, rather than CoreLab's driver doing anything strange, but I haven't found any known bugs listed at Microsoft's site, and I am already using the latest version of MDAC available for my platform. I need to keep the field definition as decimal (28, 15) and EnableBCD set to False, and the customer cannot change its regional settings. Ideas?

Thanks
--
Nando

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Mon 13 Feb 2006 12:36

This is OLE DB problem.
Maybe it will be useful to you:
Knowledge Base -> English Knowledge Base Articles -> OLE DB -> PRB:
Incorrect NUMERIC and DECIMAL conversions with non-English locales(http://support.microsoft.com/kb/320744/en-us).
Try to add the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OLEAUT VarConversionLocaleSetting.
Set the DWORD value of this key to 2.

Post Reply