How to count data in Java and MySQL? The final result is shown to me through JOptionpane but I got an error message with this code.
try { DBConn.conn = DriverManager.getConnection(DBConn.Url, DBConn.User, DBConn.PWD);
java.sql.Statement count = DBConn.conn.createStatement();
String SQLCount = "select count(*) from datastudent where parklevel = 'Level 1' ";
ResultSet rs = count.executeQuery(SQLCount);
while (rs.next()) {
JOptionPane.showMessageDialog(null,"number of existing parking is " + rs);
}
} catch (Exception e2) {
//
}
}