[thelist] SQL Prob. with ASP
Michele Foster
michele at wordpro.on.ca
Fri Apr 6 02:22:08 CDT 2001
Hi folks,
I'm having a problem getting some records updated in my database.
Here's the code I'm using.
<code>
Set cnn = CreateObject("ADODB.Connection")
cnn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &
server.mappath("/craftersshowcase/database/crafters.mdb")
For Each x In Request.Form
If left(x, 7) = "LineID_" then
varQuantity = trim(request.Form(x))
varOrderDetailID = Replace(x, "LineID_", "")
End If
Next
BuildSQL = "SET Quantity = " & varQuantity & " WHERE OrderDetailID = " &
varOrderDetailID & ""
SqlString = "UPDATE ItemsOrdered " & BuildSQL & ""
cnn.execute SqlString
</code>
Print out of the SQL returns this:
UPDATE ItemsOrdered SET Quantity = 5 WHERE OrderDetailID = 78
The error message I'm getting is this:
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/craftersshowcase/updatecart.asp, line 29
Where line 29 is cnn.execute SqlString
Quantity is a number
OrderDetailID is AutoNumber
I have tried this SQL instead, but I still get the same error.
UPDATE ItemsOrdered SET Quantity = '5' WHERE OrderDetailID = '78'
There are several other fields in the table. (Does that matter? - I only
want to change this one value.)
There is another column containing OrderNo that is related to other tables.
Does that matter?
TIA,
Michele
*going to bed*
More information about the thelist
mailing list