I’m beginner in Java but I has the following code
limit = con.prepareStatement("SELECT COUNT(*) FROM San_CadastraDigital WHERE Cliente_Id = ?");
public String Verify(String client) {
try {
limit.setString(1, client);
ResultSet rs = limit.executeQuery();
while (rs.next()) {
int limitDigital = rs.getInt(0);
if (limitDigital < 3) {
return "1";
} else {
return "0";
}
}
} catch (SQLException e) {
ui.writeLog(e.getMessage());
return "0";
}
return "0";
}
But I got an error that said that column in index 0 is out of the range.
My query works fine in my database.
How can I get the result of my query ?
According to the API docs for ResultSet#getInt(int):