0
I want to select with the Count function and bring all the records of a table, but when presenting the quantity in the textfield, it displays a different result. I’ll put the code in for you to analyze:
Error presented
My code
public void TrazerValores(){
try {
String Tabela = "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");
}
}