我已将主题定义为
public String[]subjects= {"English","Maths","Science","Social","Programming","Production_Project","20","ENG_MARKS"};
我在准备好的声明中使用了以下代码。但它在oracle中给我无效的列错误。
JComboBox comboBox = new JComboBox(subjects);
comboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Selected_subject = (String)comboBox.getSelectedItem();
}
});
准备好的声明代码
JButton btnNewButton_2 = new JButton("Upload");
btnNewButton_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String up_assignments = "UPDATE student_assignments set ? = ? WHERE student_id = 2";
try {
PreparedStatement ps = connection.prepareStatement(up_assignments);
ps.setString(1, Selected_subject);
ps.setInt(2, 25);
ps.execute();
}catch(Exception ex)
{
ex.printStackTrace();
}
}
});