Hello there. I'm getting a syntax error in this statement after I did a test submit on my form:
"Microsoft JET Database Engine error '80040e14'
Syntax error (missing operator) in query expression 'c_name='Golden Wattle' AND sc_name='Acacia pycnantha' AND url='http://anpsa.org.au/a-pyc.html' AND image='http://anpsa.org.au/jpg/029_2.jpg' AND price='$72' AND information='Golden Wattle is Australia's national floral emblem.''.
/courses/benv/2410/2013s2/3420384/exercises/ex05/insert-plant.asp, line 54"
I can't, for the life of me, understand what is wrong here.
dim cn, sc, url, image, price, desc
cn=Request.Form("new_cn")
sc=Request.Form("new_sc")
url=Request.Form("new_url")
image=Request.Form("new_image")
price=Request.Form("new_price")
desc=Request.Form("new_desc")
'--- check to see whether there already are items of that name...
SQL="select ID from PlantTable where c_name='"& cn & "' AND sc_name='" & sc & "'"&_
" AND url='"&url& "' AND image='"&image& "' AND price='"&price& "' AND information='"&desc& "' "
set info = conn.execute(SQL)
if info.eof then
'--- there is no plant of that name at present, so do the insert
SQL="insert into PlantTable (c_name, sc_name, url, image, price, information) values ('" & cn & "', "&sn&","&url&","&image&","&price&","&desc&")"
conn.execute(SQL)
response.write "Insertion completed."
else
'--- there is already a plant of that name...
response.write "Sorry, that Plant Name is already in the database."
end if
Microsoft JET Database Engine error '80040e14' Syntax error in INSERT INTO statement. /courses/benv/2410/2013s2/3420384/exercises/ex05/insert-plant.asp, line 61I tried printing out the statement for that but no luck so far in finding the error. - chap