Solved

ASP Syntax - missing operator

Posted on 2014-01-23
5
304 Views
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


error:
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
0
Comment
Question by:bschwarting
[X]
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
5 Comments
 
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
0
 
LVL 33

Accepted Solution

by:
Big Monty earned 500 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

0
 
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

0
 
LVL 58

Expert Comment

by:Gary
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") & "'"
0
 
LVL 1

Author Comment

by:bschwarting
ID: 39805024
thanks so much all!
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Multi-Column Repeater 3 39
Set the FileVersion of a website dll 1 59
CSS for Popup in ASP.NET 4 49
Get Pop-Up Or Div Info Box From JQuery DataTable Cell in ASP 7 35
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

738 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