问题
Ok, I'm going crazy on this one. MySQL is throwing a fit about this bit of SQL:
INSERT INTO `test_table`
( `column1`, `column2` )
VALUES
( ?COURSEID, ?COURSENAME )
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COURSENAME )' at line 1
My debug code is showing both of the parameter values filled.
回答1:
MySQL does not support named parameter placeholders. You can use only positional parameter placeholders. That is, a placeholder is just a ? symbol.
This conforms to the ANSI SQL behavior, by the way. RDBMS like Oracle support named parameters as an extension to the standard.
回答2:
Not sure if that will work. I would change to either
VALUES (?, ?)
OR
VALUES (:COURSEID, :COURSENAME)
来源:https://stackoverflow.com/questions/1457597/mysql-rejecting-parameter