Professional Web Applications Themes

Converting data type varchar to data type money - Coldfusion - Getting Started

Hi all, Tearing my hair out trying to figure this out. If anyone can provide any help i would greatly appreciate it. When I try to do an insert into my MS SQL Database, keep getting following error.... [Macromedia][SQLServer JDBC Driver][SQLServer]Disallowed implicit conversion from data type varchar to data type money, table '05NeoCon.dbo.RegistrationT', column 'AmtPaid'. Use the CONVERT function to run this query. The error occurred in D:\mmpi\showreg\neoconseminar\scout\insertdata.cfm : line 21 Called from D:\mmpi\showreg\neoconseminar\scout\insertdata.cfm : line 9 Called from D:\mmpi\showreg\neoconseminar\scout\insertdata.cfm : line 7 Called from D:\mmpi\showreg\neoconseminar\scout\insertdata.cfm : line 1 Called from D:\mmpi\showreg\neoconseminar\scout\insertdata.cfm : line 21 Called from D:\mmpi\showreg\neoconseminar\scout\insertdata.cfm : line ...

  1. #1

    Default Converting data type varchar to data type money

    Hi all,

    Tearing my hair out trying to figure this out. If anyone can provide any help
    i would greatly appreciate it. When I try to do an insert into my MS SQL
    Database, keep getting following error....

    [Macromedia][SQLServer JDBC Driver][SQLServer]Disallowed implicit conversion
    from data type varchar to data type money, table
    '05NeoCon.dbo.RegistrationT', column 'AmtPaid'. Use the
    CONVERT function to run this query.

    The error occurred in D:\mmpi\showreg\neoconseminar\scout\insertdata.cfm : line
    21
    Called from D:\mmpi\showreg\neoconseminar\scout\insertdata.cfm : line 9
    Called from D:\mmpi\showreg\neoconseminar\scout\insertdata.cfm : line 7
    Called from D:\mmpi\showreg\neoconseminar\scout\insertdata.cfm : line 1
    Called from D:\mmpi\showreg\neoconseminar\scout\insertdata.cfm : line 21
    Called from D:\mmpi\showreg\neoconseminar\scout\insertdata.cfm : line 9
    Called from D:\mmpi\showreg\neoconseminar\scout\insertdata.cfm : line 7
    Called from D:\mmpi\showreg\neoconseminar\scout\insertdata.cfm : line 1

    19 : '<cfloop from="1" to="#arrayLen(session.semcart)#"
    index="i">#DollarFormat('#session.semcart.ActCost# ')##chr(13)##chr(10)#</cfloop>
    ',
    20 : '<cfloop from="1" to="#arrayLen(session.semcart)#"
    index="i">#rtrim('#session.semcart.ActTime#')##chr (13)##chr(10)#</cfloop>',
    21 :
    #DollarFormat('#session.totalprice#')#,'#session.S pamPhone#','#session.SpamFax#'
    ,'#session.SpamEmail#','#session.SpamMail#','#sess ion.Spam3rdParty#');
    22 : </cfquery>
    23 :


    First off, can someone please explain why i'm getting this error? And also,
    can you please tell me how I would convert #session.totalprice# from data type
    varchar to data type money in order to make SQL happy? Thanks in advance for
    your help.

    Salman

    schaudry Guest

  2. #2

    Default Re: Converting data type varchar to data type money

    Instead of dollarformat() (which I think inserts the $ symbol before the price)
    have you tried LSCurrencyFormat( session.totalprice, "none" ) instead? This
    will convert the total price into the 0.00 formatted datatype I guess you're
    looking for.

    Phil

    Fychan66 Guest

Similar Threads

  1. Converting from data type varchar to data type money
    By schaudry in forum Coldfusion - Advanced Techniques
    Replies: 6
    Last Post: June 10th, 11:01 PM
  2. Replies: 3
    Last Post: October 18th, 06:56 AM
  3. Replies: 2
    Last Post: October 16th, 08:29 AM
  4. <<Error converting data type char to smalldatetime>>
    By Gary D. Rezek in forum ASP Database
    Replies: 9
    Last Post: September 17th, 06:57 PM
  5. Converting Strings to SmallMoney Data Type
    By rwiethorn in forum Microsoft SQL / MS SQL Server
    Replies: 1
    Last Post: July 2nd, 01:52 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