炫意html5
最早CSS3和HTML5移动技术网站之一

sql插入语句

java代码如下:

preparedStatement = connection.prepareStatement("INSERT INTO books (anthor,bookName,press,introduction,onSaleTime,index,html) VALUES(?,?,?,?,?,?,?);");
preparedStatement.setString(1, each.getAuthor());
preparedStatement.setString(2,newName);
preparedStatement.setString(3, each.getPress());
preparedStatement.setString(4,each.getIntroduction());
preparedStatement.setString(5,onSaleTime);
preparedStatement.setString(6,index);
preparedStatement.setString(7,sourthBookUrl);
preparedStatement.executeUpdate();

数据库为:

错误显示为:

java.sql.SQLSyntaxErrorException: 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 ‘index,html) VALUES(‘习近平’,’习近平谈治国理政’,’外文出版社’,’庆’ at line 1

回答

index 是 关键字,要加 反引号(`)括起来?试试

炫意HTML5 » sql插入语句

Java基础教程Android基础教程