遇到的情景:
sta.executeUpdate("insert into 表1(longitude,latitude,time) values("+a[0]+","+a[1]+","+a[2]+")");
报错信息:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] INSERT INTO
语句的语法错误。
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at
sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at
sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
at
sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
改正:
ta.executeUpdate("insert into 表1(longitude,latitude,[time]) values("+a[0]+","+a[1]+","+a[2]+")");
原因分析:
time是SQL语句中的关键字(终于发现了%>_<%)
[Microsoft][ODBC Microsoft Access Driver] INSERT INTO 语句的语法错误。,布布扣,bubuko.com
[Microsoft][ODBC Microsoft Access Driver] INSERT INTO 语句的语法错误。