Professional Web Applications Themes

Money amount shows as "1,23" instead of "1.23" - Microsoft SQL / MS SQL Server

I don't know if this is a SQL Server issue or ADO.NET, but here goes- I have a sql server table with a Price column. The prices are in the format "1.23", but (this uses an ADO.NET datareader) it's being read as "1,23" which causes a problem.Is this a setting in SQL Server? Tks Justin Dutoit...

  1. #1

    Default Money amount shows as "1,23" instead of "1.23"

    I don't know if this is a SQL Server issue or ADO.NET, but here goes- I have
    a sql server table with a Price column. The prices are in the format "1.23",
    but (this uses an ADO.NET datareader) it's being read as "1,23" which causes
    a problem.Is this a setting in SQL Server?

    Tks
    Justin Dutoit


    Justin Guest

  2. #2

    Default Re: Money amount shows as "1,23" instead of "1.23"

    The server is in Europe. What do I do, assuming their culture uses commas?

    Tks
    Justin
    "Majid Qazi" <com> wrote in message
    news:ek$phx.gbl... 
    > have 
    > "1.23", 
    > causes 
    >
    >[/ref]


    Justin Guest

  3. #3

    Default Re: Money amount shows as "1,23" instead of "1.23"

    Justin
    Try replace the ',' with '.'. Please refer to BOL (REPLACE function)



    "Justin Dutoit" <com> wrote in message
    news:phx.gbl... [/ref][/ref]

    > > "1.23", 
    > > causes 
    > >
    > >[/ref]
    >
    >[/ref]


    Uri Guest

  4. #4

    Default Re: Money amount shows as "1,23" instead of "1.23"

    If he really wants . and not , then i would say that the
    best thing to do is change the collate. But they are
    probably using , and not . in the country where the server
    is located.

    Regards,
    Kristofer Gafvert
     
    (REPLACE function) [/ref]
    culture uses commas? [/ref]
    message [/ref][/ref]
    displayed. In some [/ref][/ref]
    the "," . [/ref][/ref]
    ADO.NET, but here goes- [/ref][/ref]
    are in the format [/ref][/ref]
    read as "1,23" which 
    >>
    >>[/ref]
    >
    >
    >.
    >[/ref]
    Kristofer Guest

  5. #5

    Default Re: Money amount shows as "1,23" instead of "1.23"

    Neither the SQL server or ADO.NET has anything to do with this. The
    datareader receives the data as a value of type decimal. This is a native
    ..NET datatype, and it is just a binary value. By the way, I assume that the
    datatype of the column is a numeric type, like money, decimal or numeric.

    The "," is generated when you are converting the value to a string for
    display. You do not say exactly how you are converting the value to a
    string, but the default is to use the culture settings on the local machine
    which would give a "," in France or a "." in the US.

    If you need to convert the value to a string using a specific culture, you
    will have to specify the culture explicitly. Search for CultureInfo in the
    ..NET doentation for more information.

    /SG

    The sql server has nothing to do with this -
    "Justin Dutoit" <com> wrote in message
    news:phx.gbl... 
    have 
    "1.23", 
    causes 


    Stefan Guest

  6. #6

    Default Re: Money amount shows as "1,23" instead of "1.23"

    Justin:

    I got that problem and it seemed to me an ADO issue related to
    client's regional configuration. Got it fixed returning a varchar type
    instead of datetime (in my case was not a money column, but maybe the
    regional question still applies). Another workaround (in client side)
    is to force a replace of ',' with '.' once retrieved the value.

    Greetings

    Diego Buendia
    Barcelona, Spain



    "Justin Dutoit" <com> wrote in message news:<phx.gbl>... 
    DIEGO Guest

  7. #7

    Default Re: Money amount shows as "1,23" instead of "1.23"

    Thanks all for that- I'm looking at the culture setting in web.config next
    ....

    Justin

    "DIEGO BUENDIA" <ES> wrote in message
    news:google.com... 
    news:<phx.gbl>... [/ref]
    have [/ref]
    "1.23", [/ref]
    causes [/ref]


    Justin Guest

  8. #8

    Default Re: Money amount shows as "1,23" instead of "1.23"

    Here is a bit of code that I added to begining of the page_load.

    Dim CloneCulture As New
    CultureInfo(System.Globalization.CultureInfo.Curre ntCulture.Name, False)

    CloneCulture.NumberFormat.NumberDecimalSeparator = "."

    System.Threading.Thread.CurrentThread.CurrentCultu re = CloneCulture



    I am working in a french local. I changed the decimal seperator the regional
    settings and .NET didn't seem to pick it up so I had to hardcode the .
    seperator. If you are creating at international app this might be a problem
    for those how want to see it as a ,.

    "Justin Dutoit" <com> a écrit dans le message de news:
    phx.gbl... 
    > news:<phx.gbl>... [/ref][/ref]
    I [/ref]
    > "1.23", [/ref]
    > causes [/ref]
    >
    >[/ref]


    Pascal Guest

Similar Threads

  1. Replies: 1
    Last Post: April 24th, 01:27 PM
  2. CFINPUT type="radio" w/ "value" requires "label"
    By Iceborer in forum Macromedia ColdFusion
    Replies: 2
    Last Post: February 21st, 06:16 PM
  3. #26162 [NEW]: $a="0abcdefg";if ($a==0) echo "OK"; result is "OK" ?!
    By zhuminglun at yahoo dot com dot cn in forum PHP Development
    Replies: 0
    Last Post: November 7th, 12:04 PM
  4. dr("field").toString returns "400.0000" instead of "400"
    By Dan C Douglas in forum ASP.NET General
    Replies: 5
    Last Post: July 22nd, 05:48 PM
  5. "Start" "Program" "Menu" list is empty
    By Pete in forum Windows XP/2000/ME
    Replies: 2
    Last Post: July 10th, 10:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139