Skip navigation
Claude
Currently Being Moderated

real number returned with comma as decimal delimiter

Apr 17, 2012 11:44 AM

Hi,
I have CF9 installed on W7 using an Access database.
In a table I have a currency value of
-488.7

The windows is French, but I have set the delimiter for both the decimal values AND currency values to dot instead of comma.

Though I get this error in CF:

The value -488,7 cannot be converted to a number.

CF is receiving the value with a comma instead of a dot.

- If I browse the table under Access, the value is correctly displayed with a dot.

- If I modify the column type to teTEXT instead of real or currency, the value is converted to text with a dot, and there is no error in CF.

Obviously a conversion from dot to comma is made in some other layer, but where?

I've checked in the ODBC connection and found nothing.

 

Any idea?

 
Replies
  • Currently Being Moderated
    Apr 18, 2012 6:03 AM   in reply to Claude

    If you do a simple query and cfdump the result, do you get a period or comma?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 10:57 AM   in reply to Claude

    You mean you had a query like this:

     

    select some_text_field, etc

    union

    select some_numeric_field, etc

     

    that didn't error out?

     

    I just tried that in redbrick and sql server and in both cases, they crashed.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 19, 2012 8:42 PM   in reply to Claude

    Kind of weird indeed, you're right, it should cause an error.

     

    Databases frequently do implicit conversion on string values.  So I would not expect an error unless the string could not be converted to the numeric data type its being merged with. That is how it works in sql server. For example, this automatically converts the string '0' to numeric (or whatever data type is used)

     

             SELECT '0' AS Test

             UNION

             SELECT cast(10.50 as numeric(10,2))

     

    Message was edited by: -==cfSearching==-

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points