Oi… será que alguem pode me apontar o erro disto aqui???
private boolean deleteSessoesDaProgramacao(long idProgramacao) throws SQLException{
String sql = “delete from tb_sessao where id_sessao = ?”;
String sql1 = "SELECT count(*) FROM tb_sessao s, tb_bilhete b WHERE "
+ “b.id_sessao = s.id_sessao AND s.id_programacao = ?”; // Retorna 0 se não tiver nenhum bilhete vendido
PreparedStatement stmt1 = this.connection.prepareStatement(sql1);
stmt1.setLong(1,idProgramacao);
ResultSet rs = stmt1.executeQuery();
boolean retorno;
if(rs.next()){
PreparedStatement stmt2 = this.connection.prepareStatement("UPDATE tb_sessao SET "
+ " ic_ativo = 'N' WHERE id_programacao = ?");
stmt2.setLong(1,idProgramacao);
if (stmt2.executeUpdate() > 0){
retorno = true;
} else {
retorno = false;
}
stmt2.close();
// }
} else {
PreparedStatement stmt = this.connection.prepareStatement(sql);
stmt.setLong(1, idProgramacao);
if(stmt.executeUpdate()>0){
retorno = true;
}else{
retorno = false;
}
stmt.close();
}
rs.close();
stmt1.close();
return retorno;
}
Qdo executo este código aparece uma mensagem de erro (“Before strar the ResulSet”
o que estou fazendo de errado???
=/
