If I run a query in the database returns result, however, when I run the code in java, assigning the result to a ResultSet, it appears to be empty. Can you help me?
PreparedStatement ps = conectar.con.prepareStatement("select colaborador.codigo as 'colabcod', nome,"
+ " emprestimo.codigo as 'emprescod', idcolaborador, dataempres from emprestimo, colaborador where "
+ "idcolaborador = colaborador.codigo and dataEmpres between ? and ?");
ps.setString(1, "'" + datainicial + "'");
ps.setString(2, "'" + datafinal + "'");
ResultSet rs = ps.executeQuery();
if (!rs.next()) {
JOptionPane.showMessageDialog(null, "Não há resultados para essa pesquisa");
}else{
while (rs.next()) {
model.addRow(new String[]{rs.getString("emprescod"), rs.getString("nome"),
rs.getString("dataempres"), "<Não Definido>"});
}
}