I want to make a select with the count function and bring all the records of a table, but when displaying the amount in the textfield, it displays a different result. I'll put the code for you to analyze:
Error Displayed
Mycode
publicvoidTrazerValores(){try{StringTabela="tb_produtos";
String query = "SELECT COUNT(*) FROM "+ Tabela ;
//PEGANDO CONTAGEM DE VISITANTES
PreparedStatement Stmt = con.prepareStatement(query);
ResultSet rs = Stmt.executeQuery();
txtTotalProdutos.setText(rs.toString());
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "Erro em buscar a quantidade");
}
}