2147217900 Syntax error in INSERT INTO statement
Posted on 2003-12-12
I am trying to write to my db from a form. Everyting works fine until I wanted to write an image name into a text field.
the sql string and the error output is as below;
The resource test2 has been add to the database
INSERT INTO products (name, descShort, description, resid, price, discount, Author, productCode, image, catCode, priority, featured, discontinued, live, prodinfo) VALUES ('test2', ' shsfh shsfxghsfg sxfghszfgh xfgjhxfg', 'erh szfdtz fghh zfghh azet hnc', 6, 4, False, 'ddsfsg', 'test123', 'marriage-report.jpg', 2, 1, False, False, False, False)
Data Entry was processed.
-2147217900 Syntax error in INSERT INTO statement.
The string will work if I comment out the code that writes to the image field but when I put it back the error is still there. The string looks fine and as I said it will write to the db so it can't be a permissions error can it?
I am writing the page in asp, the db is access 2000.
I am also using the following functions to write the form fields to the db.
'fn is the variable containing the field name to insert
if Request.form(fn) <> "" then
theSql = theSql + theComma + fn
theComma = ", "
'fv is the variable containing the field value to insert
if Request.form(fv) <> "" then
theSql = theSql + theComma + "'" + Request.form(fv) + "'"
theComma = ", "
the functions above seem to work but I've included them just so that you have an idea of what is going on. there is also a sqlFieldValueInsertInt function for adding numeric data which is the same as the second function above but without 'theComma' added to the string.
This is a problem I've had for a while and I've just come back to it and I'm still stumped as to why it won't work.