Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Error 80040e07 ????
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

shaneb
Junior Member

USA
319 Posts

Posted - 12 November 2001 :  15:04:39  Show Profile  Send shaneb a Yahoo! Message
Anybody know what I can do to fix this error. I'm lost.

Microsoft OLE DB Provider for SQL Server error '80040e07'

Disallowed implicit conversion from data type varchar to data type money, table 'brassin-dev.dbo.jobs', column 'hourly'. Use the CONVERT function to run this query.

/aspemployer/postjob.asp, line 123

LINE 123 is the last line of this code.


<!--#INCLUDE FILE="employer_secure.asp" -->
<!--#INCLUDE VIRTUAL="/templates/header.asp" -->
<%
Dim jobnumber, number, company, contname, conttitle, city, state, zip, country, phone
Dim fax, email, category, title, lastupdated, expiration, invoice, description
Dim datepaid, jobsposted, website, level, mode, rs, q, formaction, button, body, price
Dim hourly, yearly, perdiem, duration, projectstatus, sqlstartdate, sqlenddate, applybyemail%>
<!--#INCLUDE VIRTUAL="/_private/string.asp" -->
<!--#INCLUDE VIRTUAL="/_private/statestr.asp" -->
<!--#INCLUDE VIRTUAL="/_private/filefunctions.asp" -->
<!--#INCLUDE VIRTUAL="/_private/sendemail.asp" --><%

Sub getformaction()
if jobsposted = 0 then
Select Case Application("aryweb")(41, 0)
Case 1
formaction = "an/processorder.asp?prod=job&number=" & number
Case 2
formaction = "ib/processorder.asp?prod=job&number=" & number
Case 3
formaction = "cc/processorder.asp?prod=job&number=" & number
End Select
end if
End Sub

Sub getform
jobnumber = Request.Form("jobnumber")
number = Request.QueryString("number")
company = Request.Form("company")
contname = Request.Form("contname")
conttitle = Request.Form("conttitle")
city = Request.Form("city")
state = Request.Form("state")
zip = Request.Form("zip")
country = Request.Form("country")
phone = Request.Form("phone")
fax = Request.Form("fax")
email = Request.Form("email")
category = Request.Form("category")
title = Request.Form("title")
lastupdated = Request.Form("lastupdated")
expiration = Request.Form("expiration")
invoice = Request.Form("invoice")
description = Request.Form("description")
website = Request.Form("website")
level = Request.Form("level")
jobsposted = CInt(Request.Form("jobsposted"))
applybyemail = Request.Form("applybyemail")
if (applybyemail = "") OR (applybyemail = "0") then
applybyemail = 0
else
applybyemail = 1
end if
projectstatus = Request.Form("projectstatus")
startdate = Request.Form("startdate")
if NOT IsDate(startdate) then
sqlstartdate = "NULL"
else
sqlstartdate = "'" & startdate & "'"
end if
enddate = Request.Form("enddate")
if NOT IsDate(enddate) then
sqlenddate = "NULL "
else
sqlenddate = "'" & enddate & "'"
end if
hourly = Replace(Request.Form("hourly"), ",", "")
if hourly = "" then hourly = "0"
perdiem = Replace(Request.Form("perdiem"), ",", "")
if perdiem = "" then perdiem = "0"
yearly = Replace(Request.Form("yearly"), ",", "")
if yearly = "" then yearly = "0"
duration = Request.Form("duration")
End Sub

Sub getemployer()
q = "SELECT company, contname, conttitle, address, city, state, zip, country, phone, " &_
"fax, email, website, level_, datepaid, jobsposted, invoice, description " &_
"FROM employers WHERE number = " & number
openconn
Set rs = cn.Execute(q)
company = rs("company").Value
contname = rs("contname").Value
conttitle = rs("conttitle").Value
city = rs("city").Value
state = rs("state").Value
zip = rs("zip").Value
country = rs("country").Value
phone = rs("phone").Value
fax = rs("fax").Value
email = rs("email").Value
website = rs("website").Value
level = rs("level_").Value
datepaid = rs("datepaid").Value
jobsposted = rs("jobsposted").Value
invoice = rs("invoice").Value
if invoice > 0 then invoice = 1
rs.Close
Set rs = Nothing
closeconn
getformaction
button = "Add"
end Sub

mode = Request("mode")
formaction = "postjob.asp"
element1 = "Select at Least One"

Select Case mode
Case "insert"
getform
expiration = Application("aryweb")(26, 0)
q = "INSERT INTO jobs (password, company, contname, conttitle, city, state, zip, country, " &_
"phone, fax, email, category, title, expiration, invoice, description, hourly, yearly, perdiem, duration, projectstatus, " &_
"startdate, enddate, applybyemail)" &_
"VALUES(" & number & ", '" & sqlstr(company) & "', '" & sqlstr(contname) &_
"', '" & sqlstr(conttitle) & "', '" & sqlstr(city) & "', '" & statestr(state) &_
"', '" & zip & "', '" & country & "', '" & phone & "', '" & fax & "', '" & email & "', '" &_
sqlstr(category) & "', '" & sqlstr(title) & "', '" & sqlstr(hourly) & "', '" & sqlstr(yearly) & "', '" & sqlstr(perdiem) &_
"', '" & sqlstr(duration) & "', '" & sqlstr(projectstatus) & "', '" & sqlstr(startdate) & "', '" & sqlstr(enddate) &_
"', '" & sqlstr(applybyemail) & "', '" & expiration &"', '" & invoice & "', '" & sqlstr(description) & "')"
openconn
cn.Execute(q)


'Surround your mind and you shall see a great future ahead'

Shane B.

Doug G
Support Moderator

USA
6493 Posts

Posted - 12 November 2001 :  16:00:25  Show Profile
Just guessing, you may have ' ' around a value for a money column in your insert statement. Perhaps you need to CAST the value to get the correct datatype.


======
Doug G
======
Go to Top of Page

shaneb
Junior Member

USA
319 Posts

Posted - 12 November 2001 :  16:36:27  Show Profile  Send shaneb a Yahoo! Message
quote:

Just guessing, you may have ' ' around a value for a money column in your insert statement. Perhaps you need to CAST the value to get the correct datatype.


======
Doug G
======




What do you mean. Can you show me?



'Surround your mind and you shall see a great future ahead'

Shane B.

Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 12 November 2001 :  21:43:53  Show Profile
If a column is a money datatype, you don't want the data value in your insert to have ' around it.

Here's a snip from the docs on CAST, you can find the complete description in the MSDN online documentation for SQL Server at http://msdn.microsoft.com/library

CAST

Explicitly converts an expression of one data type to another. CAST and CONVERT provide similar functionality.

Syntax
Using CAST:

CAST ( expression AS data_type )

Using CONVERT:

CONVERT ( data_type [ ( length ) ] , expression [ , style ] )



======
Doug G
======
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.35 seconds. Powered By: Snitz Forums 2000 Version 3.4.07