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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update quantity in stock

Status
Not open for further replies.

lynque

IS-IT--Management
Sep 30, 2004
124
CA
Hi all,

I have a products table that I would like to update when an order comes in here is the code

set rsUpdateQuantity = Server.CreateObject("ADODB.Recordset")
rsUpdateQuantity.Open "SELECT * FROM products WHERE orderID = " _
& intOrderID, Conn, adOpenStatic, adLockOptimistic, _
adCmdTable

if rsUpdateQuantity.numInStock > 1 then
numInStock - 1
else
DELETE
end if

rsUpdateQuantity.Update
rsUpdateQuantity.Close

It is currently throwing this error
Syntax error in FROM clause.

Any help is appreciated
 
Do this

Code:
set rsUpdateQuantity = Server.CreateObject("ADODB.Recordset")
            [b]Response.Write [/b]"SELECT * FROM products WHERE orderID = " _
            & intOrderID, Conn, adOpenStatic, adLockOptimistic, _
             adCmdTable

[b]response.end[/b]

            
                if rsUpdateQuantity.numInStock > 1 then
                    numInStock - 1
                else
                    DELETE
                end if
                
            rsUpdateQuantity.Update
        rsUpdateQuantity.Close

Then troubleshoot your sql...should be a dead giveaway
 
You might also need to put single quotes around the order id like this:

WHERE orderID = '"& intOrderID & "'"

It might not be correctly finding the end of the sql query.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top