Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disallowed implicit conversion Error

Status
Not open for further replies.

mikecx

Technical User
Jul 9, 2002
215
US
When I try to pull a number from a form and put it into a money field of my DB I get this error. The form is a text field and the text I entered is 33.00. I've tried other number and no of those work either ;) . Help!

INSERT INTO dbo.payments (username, payment) VALUES ('AFD', '33')
Microsoft OLE DB Provider for SQL Server error '80040e07'

Disallowed implicit conversion from data type varchar to data type money, table 'AMS.dbo.payments', column 'payment'. Use the CONVERT function to run this query.

/admin/addpayment.asp, line 56

I'm kinda still a Newb and need some help. I can post any other info needed but I need to get this working by Thur.
 
Still not working:

Code:


rfuname = Trim(Request.Form("username"))
rfpayment = CCur(Request.Form("payment"))

strSQL = "INSERT INTO dbo.payments (username, payment) VALUES ('" & rfuname & "', '" & rfpayment & "')"



/Code

More Code:

Payment:&nbsp;$<input type=text name=payment class=&quot;textbox&quot; size=3></text><i>($x.xx format)</i>

/more code
 
I noticed you have a </text> above. I'm not sure what that is, but I don't think you need it in this example.

If you are including the $ in the textbox, then you need to strip this before using it to update the database. The Currency,Money, or whatever datatype won't accept it.

Also, remove the single quotes around the rfpayment variable in your sql.

My daily story these days:
9am [pc2] => 3p [flush] => 6p [pc2] => 10p [yawn2] 12a [hammer] => 1a [pc1] 3a [sleeping] => fri [cheers]
 
Try removing the quotes around the number your inserting. I can't seem to remember for sure, but I think currency values do not need the quotes. The dolllar sign isn't in the vae of the textbox in your html so it shouldn't be an issue.

-Tarwn ________________________________________________
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top