Trabla: java & JDBC: select one row
Solving:
...
String query = "SELECT COUNT(id) FROM tbl_users";
ResultSet resultSet = statement.executeQuery( query );
// Just one result row
resultSet.next();
// Use column index, because it has no name
int columnIndex = 1;
int totalUsers = resultSet.getInt( columnIndex );
....
No comments:
Post a Comment