Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


ASP Syntax - missing operator

Posted on 2014-01-23
Medium Priority
Last Modified: 2014-01-23
Frustrating day today, I can't seem to find any of my errors.  Can someone assist please?

mySQL3 = "UPDATE inventory SET quantity = currentqtyminus1 WHERE [productname] = " & Request.Form("productname")

Open in new window

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '[productname] = Test Product'.
/triplels/insertDBsale.asp, line 64
Question by:bschwarting
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 33

Expert Comment

by:Big Monty
ID: 39804954
mySQL3 = "UPDATE inventory SET quantity = currentqtyminus1 WHERE [productname] = '" & Request.Form("productname") & "'"

Open in new window

if you had looked at and tried to implement my code with parameterized queries from your last post, you would not be having these problems
LVL 33

Accepted Solution

Big Monty earned 2000 total points
ID: 39804958
and if currentqtyminus1 is a asp local variable and not a column in your database, it would be:

mySQL3 = "UPDATE inventory SET quantity = " & currentqtyminus1 & " WHERE [productname] = '" & Request.Form("productname") & "'"

Open in new window

LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39804966
and to protect against sql injection:
mySQL3 = "UPDATE inventory SET quantity = currentqtyminus1 WHERE [productname] = '" & replace(Request.Form("productname"), "'", "''") & "'" 

Open in new window

LVL 58

Expert Comment

ID: 39804978
No points for this as Monty has answered the question but...
If you are just decreasing the quantity by 1 every time you can do

mySQL3 = "UPDATE inventory SET quantity =quantity -1  WHERE [productname] = '" & Request.Form("productname") & "'"

Author Comment

ID: 39805024
thanks so much all!

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question