Source code of count operation in java gui.
try{
String sql = "select count(id) from user";
pst = con.prepareStatement(sql);
rs = pst.executeQuery();
if(rs.next()){
String cnt = rs.getString("count(id)");
jTextField_count.setText(cnt);
}
}catch(SQLException e){
JOptionPane.showMessageDialog(null, e);
}
Be First to Comment