Web Hosting Talk







View Full Version : Another (probably simple) ASP Problem


jordanfish1
05-05-2008, 09:48 AM
I am getting;

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

/cwk/customer_orderproduct.asp, line 19

when I run;

<!--#include file="logon.inc"-->
<%
If Session("Email") = "" then
Response.Redirect "login.asp"
End if

productid = request.form("productid")
quantity = request.form("quantity")
orderid = request.form("orderid")

dim orseof
set db=server.createobject("adodb.connection")
set orseof=server.createobject("adodb.recordset")
db.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &

Server.MapPath("joannemahoney.mdb")

strsql = "INSERT INTO tblOrderitems"
strsql = strsql+"(orderid,productid,quantity)Values"
strsql = strsql+"('"&orderid&"','"&productid&"','"&quantity&"')"
orseof.open strsql,db

dim orseof2
set db=server.createobject("adodb.connection")
set orseof2=server.createobject("adodb.recordset")
db.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &

Server.MapPath("joannemahoney.mdb")

strsql = "SELECT price FROM tblproduct WHERE productid = "&productid&" "
orseof2.open strsql,db

orseof2.movefirst
price = orseof2("price")

dim orseof3
set orseof3=server.createobject("adodb.recordset")
qrySQL = "SELECT subtotal FROM tblorder WHERE orderid = "&orderid&" "
orseof3.open qrySQL,db

orseof3.movefirst
subtotal = orseof3("subtotal")

subtotal = subtotal + price*quantity

dim orseof4
set db=server.createobject("adodb.connection")
set orseof4=server.createobject("adodb.recordset")
db.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &

Server.MapPath("joannemahoney.mdb")

qrsql = "UPDATE tblOrder set subtotal='"&subtotal&"' where orderid="&orderid&"; "
set orseof4=db.Execute (qrSql)

response.redirect "customer_order1.asp?0rderid="&orderid&""

%>

all fields in the tblOrderItems are integers.

Can anyone offer any input here? Thanks if so, I am new to asp and I need all the help possible!

jimpoz
05-05-2008, 02:26 PM
Try removing the single quotes in this line:

strsql = strsql+"('"&orderid&"','"&productid&"','"&quantity&"')"

strsql = strsql+"("&orderid&","&productid&","&quantity&")"

jordanfish1
05-05-2008, 02:36 PM
I got it, it was because the product id field wasn't updating from the last page. Thanks though!