I don't really know what is going on so I'll just post part of the code
int index2 = 0;
while(rs.next()){
System.out.println(rs.getInt("ItemID") + ", " + rs.getString("SocSecNum") + ", " + rs.getInt("Score"));
if(rs.getInt("ItemID") == ID && rs.getString("SocSecNum").equals(socSecNum)){
alreadySet = true;
System.out.println("Flag 1");
caq.executeUpdate("UPDATE ProjectScore SET Score = " + userScoreField.getText() +
" WHERE (ItemID = " + ID + ") AND (SocSecNum = '" + socSecNum + "')");
}
index2++;
System.out.println(index2);
}
System.out.println("Flag 2");
Looks like it would work yeah? Here's the output:
1, 640730-7419, 3
Flag 1
1
This would imply that the while-loop is stuck somehow but there is no additional output (index2). Also, the database is updated exactly as it should but the program doesn't progress from here and "Flag 2" is never written out. Any ideas?
Edit:
catch (SQLException e1) {
System.out.println(e1.getMessage());
System.out.println(e1.getCause());
}
Gives
Operation not allowed after ResultSet closed
null
Edit 2:
Here's the code used to make it work
PreparedStatement statement = caq.getConnection().prepareStatement("SELECT * FROM ProjectScore WHERE SocSecNum = '"
+ socSecNum + "'", ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
rs = statement.executeQuery();