I have defined subjects as
public String[]subjects= {"English","Maths","Science","Social","Programming","Production_Project","20","ENG_MARKS"};
And I have used the following code in prepared statement. but it give me invalid column error in oracle.
JComboBox comboBox = new JComboBox(subjects);
comboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Selected_subject = (String)comboBox.getSelectedItem();
}
});
Prepared Statement code
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();
}
}
});