ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 1st, 2003, 01:49 PM
jstalnaker jstalnaker is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 4 jstalnaker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Converting varchar to money

The problem I am having is that I am trying to insert data from a form into a DB, but I cannot figure out how to change the form value (varchar) to the db value (money).

I've tried cast(bill_priceA as money) and I get

Microsoft VBScript compilation error '800a03ee'

Expected ')'

/Version1/AppointmentTypeFormSubmit.asp, line 35

"values('"& RMclientID & "', '" & sku & "', '" & appointmenttype & "', '" & appointmentdesc &"','"& cast(bill_priceA as Money) &"','"& bill_priceB &"','" & bill_priceC &_
---------------------------------------------------------------------------------------------------------------------^
with the arrow landing under the a in as

I've tried convert(Money, bill_priceA) and receive

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'convert'

/Version1/AppointmentTypeFormSubmit.asp, line 33


any help is appreciated!!!


code that assigns variables from form, and creates SQL string in ASP

RMclientID = Session("RMclientID")
sku = fixit(Request.Form("sku"))
appointmenttype = fixit(Request.Form("appointmenttype"))
appointmentdesc = fixit(Request.Form("appointmentdesc"))
bill_priceA = Request.Form("bill_priceA")
bill_priceB = Request.Form("bill_priceB")
bill_priceC = Request.Form("bill_priceC")
bill_priceD = Request.Form("bill_priceD")
bill_priceE = Request.Form("bill_priceE")
commissionrateA = Request.Form("commissionrateA")
commissionrateB = Request.Form("commissionrateB")
commissionrateC = Request.Form("commissionrateC")
commissionrateD = Request.Form("commissionrateD")
commissionrateE = Request.Form("commissionrateE")
ResourceTypeNeeded1 = Request.Form("ResourceTypeNeeded1")
ResourceTypeNeeded2 = Request.Form("ResourceTypeNeeded2")
ResourceTypeNeeded3 = Request.Form("ResourceTypeNeeded3")
ResourceTypeNeeded4 = Request.Form("ResourceTypeNeeded4")
ResourceTypeNeeded5 = Request.Form("ResourceTypeNeeded5")
id = Request.Form("id")

if Request.QueryString("action")= "create" then
'Response.Write(Request.QueryString("action"))
sql = "insert into AppointmentTypes (RMclientID, sku, appointmenttype, appointmentdesc, bill_priceA, bill_priceB, bill_priceC, bill_priceD, bill_priceE, " &_
"commissionrateA, commissionrateB, commissionrateC, commissionrateD, commissionrateE, ResourceTypeNeeded1, ResourceTypeNeeded2, ResourceTypeNeeded3, ResourceTypeNeeded4, ResourceTypeNeeded5) " &_
"values('"& RMclientID & "', '" & sku & "', '" & appointmenttype & "', '" & appointmentdesc &"','"& bill_priceA &"','"& bill_priceB &"','" & bill_priceC &_
"', '" & bill_priceD & "', '" & bill_priceE & "', '" & commissionrateA & "', '" & commissionrateB & "', '"& commissionrateC & "', '"& commissionrateD &_
"', '" & commissionrateE & "', '" & ResourceTypeNeeded1 & "', '" & ResourceTypeNeeded2 & "', '" & ResourceTypeNeeded3 & "', '" & ResourceTypeNeeded4 &"', '" & ResourceTypeNeeded5 & "')"
Response.Write(sql)

Reply With Quote
  #2  
Old October 1st, 2003, 07:40 PM
pda8333 pda8333 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 216 pda8333 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 6 m 31 sec
Reputation Power: 5
hi jstalnaker,

try this.
Code:
ccur(bill_priceA)

& also your error
Code:
,'"& cast(bill_priceA as Money) &"',

should not have a single quote '
Code:
,"& ccur(bill_priceA) &",

Reply With Quote
  #3  
Old October 2nd, 2003, 04:36 PM
jstalnaker jstalnaker is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 4 jstalnaker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks! the apostrophe did the trick

Reply With Quote
  #4  
Old October 2nd, 2003, 07:16 PM
pda8333 pda8333 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 216 pda8333 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 6 m 31 sec
Reputation Power: 5
your welcome. glad to help.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Converting varchar to money


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway