Professional Web Applications Themes

Sql Server and VBScript decimal problem - ASP Database

I am pulling a decimal value from SQL server and trying to use the format currency and format number function. I am using these values in a large string of HTML to be used in a CDONTS Email. If I use the code fragment below the price variable, which is 3.92 in the database, shows up as 392. When the formatcurrency is removed it is displayed as 3.92 but!!!! if I concatenate a "" it displays 392. I have read some posts about VBscript not liking decimals, are there any ways around this. I have tried a conversion to the ...

  1. #1

    Default Sql Server and VBScript decimal problem

    I am pulling a decimal value from SQL server and trying to use the format
    currency and format number function. I am using these values in a large
    string of HTML to be used in a CDONTS Email. If I use the code fragment
    below the price variable, which is 3.92 in the database, shows up as 392.
    When the formatcurrency is removed it is displayed as 3.92 but!!!! if I
    concatenate a "" it displays 392. I have read some posts about VBscript
    not liking decimals, are there any ways around this. I have tried a
    conversion to the money datatype, used a variety of csng and cdbl functions.
    The odd thing is other numbers from the same column in the recordset format
    correctly. The other thing is that variable 'price' is used elsewhere and
    calculates correctly it seems VBscript just doesn't like converting it to a
    string. Totally stumped!! Can anyone help.

    HTML = HTML & "<td>" & formatcurrency(price) & "(&euro;" &
    formatnumber(price*rate,2) & ")" & "</td>"


    Chris Kennedy Guest

  2. #2

    Default Re: Sql Server and VBScript decimal problem

    [url]http://www.aspfaq.com/5003[/url]

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)




    "Chris Kennedy" <chrisknospamcybase.co.uk> wrote in message
    news:eKOpTOieEHA.2396TK2MSFTNGP11.phx.gbl...
    > I am pulling a decimal value from SQL server and trying to use the format
    > currency and format number function. I am using these values in a large
    > string of HTML to be used in a CDONTS Email. If I use the code fragment
    > below the price variable, which is 3.92 in the database, shows up as 392.
    > When the formatcurrency is removed it is displayed as 3.92 but!!!! if I
    > concatenate a "" it displays 392. I have read some posts about VBscript
    > not liking decimals, are there any ways around this. I have tried a
    > conversion to the money datatype, used a variety of csng and cdbl
    functions.
    > The odd thing is other numbers from the same column in the recordset
    format
    > correctly. The other thing is that variable 'price' is used elsewhere and
    > calculates correctly it seems VBscript just doesn't like converting it to
    a
    > string. Totally stumped!! Can anyone help.
    >
    > HTML = HTML & "<td>" & formatcurrency(price) & "(&euro;" &
    > formatnumber(price*rate,2) & ")" & "</td>"
    >
    >

    Aaron [SQL Server MVP] Guest

Similar Threads

  1. Replies: 0
    Last Post: November 27th, 06:14 PM
  2. InDesign "Decimal" problem Solved (e.g. 0.500500500500)
    By Sugavanan@adobeforums.com in forum Adobe Indesign Macintosh
    Replies: 8
    Last Post: October 5th, 02:35 PM
  3. RSS Feed Eater - VBScript Server Behaviour released
    By RobGT in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 0
    Last Post: April 3rd, 05:35 PM
  4. Testing Server problem: Server name or address couldnot be resolved!
    By fwilkinson in forum Coldfusion - Getting Started
    Replies: 2
    Last Post: November 9th, 08:03 PM
  5. UltraSuite 7.5.5 for ASP/VBScript server model released!
    By J.S. \(UltraSuite\) in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 2
    Last Post: July 25th, 03:38 AM

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