Professional Web Applications Themes

dr("field").toString returns "400.0000" instead of "400" - Microsoft SQL / MS SQL Server

I have just installed VS.NET 2003 on my computer. I have a project that I have been developing on VS.NET 2002. I haven't upgraded this project to VS.NET 2003 yet and I am still developing it in VS.NET 2002. When I am putting values from my SQLDataReader into labels and text boxes I am getting results such as 400.0000, or 25.90. For example... ? dr("CostsPerBin") returns 400D {Decimal} [Decimal]: 400D  returns "400.0000" It used to return "400" before I installed VS.NET2K3 Obviously it is returning 4 decimals because it is the scale of the data type in SQL. This is ...

  1. #1

    Default dr("field").toString returns "400.0000" instead of "400"

    I have just installed VS.NET 2003 on my computer. I have a project that I have been developing on VS.NET 2002. I haven't upgraded this project to VS.NET 2003 yet and I am still developing it in VS.NET 2002.

    When I am putting values from my SQLDataReader into labels and text boxes I am getting results such as 400.0000, or 25.90.

    For example...

    ? dr("CostsPerBin")

    returns

    400D {Decimal}
    [Decimal]: 400D 

    returns
    "400.0000"

    It used to return "400" before I installed VS.NET2K3

    Obviously it is returning 4 decimals because it is the scale of the data type in SQL. This is a money field, although other fields that are decimal with a scale of 2 return results such as 90.40 when converted to a string.

    Any ideas?



    It works normally on our dev box and production server and also on other developers machines.

    I am the only one in the office who has install VS.NET2K3, but I don't understand how it would change these results.

    Is this a feature of .NET Framework 1.1 ? (project is still .NET framework 1.0 as I didn't upgrade it though)



    Thanks,



    Dan

    Dan Guest

  2. #2

    Default Re: dr("field").toString returns "400.0000" instead of "400"

    This is a classic asp newsgroup. While you may be lucky enough to find a
    dotnet-savvy person here who can answer your question, you can eliminate the
    luck factor by posting your question to an appropriate group. I suggest
    microsoft.public.dotnet.framework.adonet or microsoft.public.dotnet.framework.aspnet.

    HTH,
    Bob Barrows
    Bob Guest

  3. #3

    Default Re: dr("field").toString returns "400.0000" instead of "400"

    Yep - I replied to the wrong message, somehow. Sorry about that
    "Dan C Douglas" <com> wrote in message news:%phx.gbl...
    heh.. i think your looking at another message. I posted to

    microsoft.public.dotnet.framework.adonet,

    microsoft.public.dotnet.framework.aspnet,

    microsoft.public.sqlserver.programming

    -Dan

    "Bob Barrows" <com> wrote in message news:#phx.gbl...
    This is a classic asp newsgroup. While you may be lucky enough to find a
    dotnet-savvy person here who can answer your question, you can eliminate the
    luck factor by posting your question to an appropriate group. I suggest
    microsoft.public.dotnet.framework.adonet or microsoft.public.dotnet.framework.aspnet.

    HTH,
    Bob Barrows
    Bob Guest

  4. #4

    Default Re: dr("field").toString returns "400.0000" instead of "400"

    Yeah, we had to make some small code changes when switching over to the 1.1 framework as well. Our interface to PayPal broke because it considered more than 2 decimal places to be an invalid format.

    -Mark
    "Vik" <viktorum====> wrote in message news:ekfnO$phx.gbl...
    I have similar problem. Decimal zeros don't show on my machine (NET Framework 1.0) and show on a server (Framework 1.1). I couldn't find a reason and just use str = Format(tmp, "N").

    Vik
    "Dan C Douglas" <com> wrote in message news:phx.gbl...
    I have just installed VS.NET 2003 on my computer. I have a project that I have been developing on VS.NET 2002. I haven't upgraded this project to VS.NET 2003 yet and I am still developing it in VS.NET 2002.

    When I am putting values from my SQLDataReader into labels and text boxes I am getting results such as 400.0000, or 25.90.

    For example...

    ? dr("CostsPerBin")

    returns

    400D {Decimal}
    [Decimal]: 400D 

    returns
    "400.0000"

    It used to return "400" before I installed VS.NET2K3

    Obviously it is returning 4 decimals because it is the scale of the data type in SQL. This is a money field, although other fields that are decimal with a scale of 2 return results such as 90.40 when converted to a string.

    Any ideas?



    It works normally on our dev box and production server and also on other developers machines.

    I am the only one in the office who has install VS.NET2K3, but I don't understand how it would change these results.

    Is this a feature of .NET Framework 1.1 ? (project is still .NET framework 1.0 as I didn't upgrade it though)



    Thanks,



    Dan

    Mark Guest

  5. #5

    Default Re: dr("field").toString returns "400.0000" instead of "400"

    For example we are using currency fields for large dollar amounts.

    So for a dollar amount the user wants to see: 850,190, and not 850,190.0000

    The difference is that the one machine with different results also has framework 1.1 side by side with 1.0 (even though the app should be using 1.0)

    Surprisingly cost per bin are at a dollar value, but this issue has affected hundreds of fields that never had that problem before, so it goes belong just this one field.

    And yes, in this case, I'd like to drop any trailing 0 decimals (this was done automatically before) w/o making any major modifications to the app. It just seems silly that by installing .NET Framework 1.1 that this would affect my apps running the original Framework 1.0

    "Bob Grommes" <com> wrote in message news:phx.gbl...
    I don't know why you'd get different results on one machine vs another, but you can simply tell ToString() exactly what you want and that will remove any ambiguity, now or in the future -- for example:

    ? dr("CostsPerBin").ToString("F0");

    I question, though, why you want to drop the decimal positions. Seems like cost per bin would not often be exactly at a dollar boundary. Or are you saying you just want to drop the decimals if they are all zero? Not sure if there's a standard format string that would produce that effect by itself.

    --Bob
    "Dan C Douglas" <com> wrote in message news:phx.gbl...
    I have just installed VS.NET 2003 on my computer. I have a project that I have been developing on VS.NET 2002. I haven't upgraded this project to VS.NET 2003 yet and I am still developing it in VS.NET 2002.

    When I am putting values from my SQLDataReader into labels and text boxes I am getting results such as 400.0000, or 25.90.

    For example...

    ? dr("CostsPerBin")

    returns

    400D {Decimal}
    [Decimal]: 400D 

    returns
    "400.0000"

    It used to return "400" before I installed VS.NET2K3

    Obviously it is returning 4 decimals because it is the scale of the data type in SQL. This is a money field, although other fields that are decimal with a scale of 2 return results such as 90.40 when converted to a string.

    Any ideas?



    It works normally on our dev box and production server and also on other developers machines.

    I am the only one in the office who has install VS.NET2K3, but I don't understand how it would change these results.

    Is this a feature of .NET Framework 1.1 ? (project is still .NET framework 1.0 as I didn't upgrade it though)



    Thanks,



    Dan

    Dan Guest

  6. #6

    Default Re: dr("field").toString returns "400.0000" instead of "400"

    The app was mapped to 1.1.

    I believe if I map it to 1.0 it should fix the problem.

    Still. It's good to know how installing 1.1 may affect our existing apps when we install it on production. The install (according to MS) shouldn't of effected existing apps, but according to asp.net website it does.

    I am fixing it now...
    "Mark Heimonen" <com> wrote in message news:phx.gbl...
    Yeah, we had to make some small code changes when switching over to the 1.1 framework as well. Our interface to PayPal broke because it considered more than 2 decimal places to be an invalid format.

    -Mark
    "Vik" <viktorum====> wrote in message news:ekfnO$phx.gbl...
    I have similar problem. Decimal zeros don't show on my machine (NET Framework 1.0) and show on a server (Framework 1.1). I couldn't find a reason and just use str = Format(tmp, "N").

    Vik
    "Dan C Douglas" <com> wrote in message news:phx.gbl...
    I have just installed VS.NET 2003 on my computer. I have a project that I have been developing on VS.NET 2002. I haven't upgraded this project to VS.NET 2003 yet and I am still developing it in VS.NET 2002.

    When I am putting values from my SQLDataReader into labels and text boxes I am getting results such as 400.0000, or 25.90.

    For example...

    ? dr("CostsPerBin")

    returns

    400D {Decimal}
    [Decimal]: 400D 

    returns
    "400.0000"

    It used to return "400" before I installed VS.NET2K3

    Obviously it is returning 4 decimals because it is the scale of the data type in SQL. This is a money field, although other fields that are decimal with a scale of 2 return results such as 90.40 when converted to a string.

    Any ideas?



    It works normally on our dev box and production server and also on other developers machines.

    I am the only one in the office who has install VS.NET2K3, but I don't understand how it would change these results.

    Is this a feature of .NET Framework 1.1 ? (project is still .NET framework 1.0 as I didn't upgrade it though)



    Thanks,



    Dan

    Dan Guest

Similar Threads

  1. "Page" and "Rect" props of the Field prop in Javascript API
    By ArtIn_Act@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 8
    Last Post: March 19th, 05:35 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. Replies: 0
    Last Post: November 17th, 10:56 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