Results 1 to 3 of 3
  1. #1

    Another (probably simple) ASP Problem

    I am getting;

    Code:
    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;

    Code:
    <!--#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!

  2. #2
    Join Date
    Sep 2004
    Posts
    105
    Try removing the single quotes in this line:

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

  3. #3
    I got it, it was because the product id field wasn't updating from the last page. Thanks though!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •