Reputation: 1806
I have a Numeric(26,10) column "x" in SQL Server 2008. When I try to read the column values using TADOQuery's FieldByName('x').AsExtended, I get an error "32,7893256547 is not a valid BCD value".
"32,7893256547" is one of the column values.
This happens only on some computers. On those computers, When I change the windows setting "No. of digits after decimal" to 9 in region settings, then everything works fine.
I see that column is mapped to TFMTBCDField in ADOQuery.
Is it a problem with BCD conversions / formatting ? And how can I solve this problem?
Platform: Windows 7, Delphi 2009, SQL Server 2008.
Upvotes: 2
Views: 6675
Reputation: 683
Me helps change in Windows 7 decimal point from comma to point and back in Start > Control panel > Clock, language and Region > Change date, time and numbers format and change decimal point for numbers and currency from to comma to point or the other way around and back.
Sorry, but I'm using Windows in Czech and we have comma separator as default decimal point. Some caption are translated to English by me so they needn't be exact.
Upvotes: 1
Reputation: 307
I had the same problem when I tried to use
ADOQuery1.FieldByName('YourField').AsString;
Solved with this:
BCDToStrf(ADOQuery1.FieldByName('YourField').AsBCD,ffFixed,11,3) ;
Upvotes: 1