Results 1 to 4 of 4

Thread: convert data to currency

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2000
    Posts
    29

    Question

    My dB has a column name called price and the value of currency how do you convert it to currency?

    i have this in place
    If Request.Form("price") = vbNullString Then
    strSQL = strSQL & "0,"
    Else
    strSQL = strSQL & ccur(Request.Form("price")) & ","
    End If
    and i get this error
    Disallowed implicit conversion from data type varchar to data type money, table 'ShaganappiTest.dbo.used_cars', column 'Price'. Use the CONVERT function to run this query.
    I assums i Have to do something with the 0 but what....


  2. #2
    Guest

    Angry





    Try the following:
    If Request.Form("price") = "" Then
    strSQL = strSQL & "CCur(0),"
    Else
    strSQL = strSQL & ccur(Request.Form("price")) & ","
    End If


  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2000
    Posts
    29

    that worked thanx

    whats wrong with this? get a syntax error the code below is for a text area

    If Len (Request.Form("additional")) > 0 Then
    strSQL = strSQL & AddSQLQuotes(Request.Form("additional"), "'") & ","
    strSQL = strSQL & Cstr(Request.Form("additional")) & "'"
    End If

    <textarea rows="5" cols="68" name="additional" value="<%If VehicleID <> 0 Then Response.Write(rsData.Fields("additional")) end if%>"></textarea>

  4. #4
    Banned
    Join Date
    Feb 2000
    Location
    Edmonton, AB, Canada
    Posts
    64
    If I understand you correctly, use this:

    Code:
    strPrice = "$" & intDollars & "." & intCents

Posting Permissions

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



Click Here to Expand Forum to Full Width