我收到一个错误,上面写着“语法错误:在第 1 行第 69 列遇到“年份””
这是我的代码
public void UpdateRecord(String sql1, String sql2, String sql3, String sql4, int sql5, String sql6) {
try {
PreparedStatement stt = conn.prepareStatement("update Students set ic = ?, name = ?, level = ?, programmecode = ?, year = ? where id = " + sql6);
stt.setString(1, sql1);
stt.setString(2, sql2);
stt.setString(3, sql3);
stt.setString(4, sql4);
stt.setInt(5, sql5);
//stt.setString(6, sql6);
stt.executeUpdate();
//stt.close();
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, ex.getMessage(), "ERROR", JOptionPane.ERROR_MESSAGE);
}
}
虽然异常说明错误源自“YEAR”,但我没有找到任何
这里是sql表
CREATE TABLE STUDENTS (
ID VARCHAR(10) not null primary key,
IC VARCHAR(14) unique,
NAME VARCHAR(50),
LEVEL CHAR(1),
PROGRAMMECODE VARCHAR(3),
YEAR INTEGER,
foreign key (PROGRAMMECODE) references PROGRAMMES(CODE)
);