So I am trying to get the result as count from a sql query as follows
ResultSet rs = st.executeQuery("SELECT count(employeeID) FROM employee WHERE " +
"employeeID='"+_empID+"' AND password = '"+_password + "'");
so i am also trying to convert that value to int and I tried the follwing
for (; rs.next();) {
val = (Integer) rs.getObject(1);
}
I have also try
val = Integer.parseInt(rs.getObject(1));
but nothing I get the following errors
java.lang.Long cannot be cast to java.lang.Integer
How can I do this.. so if that returns a 0,3 or 4 that it becomes an integer?
Thank you
EDITED TO: (STILL GETTING ERROR)
long countLong = 0;
for (; rs.next();) {
countLong = rs.getLong(1);
}
if(countLong < 1)
{
isAuthentic = false;
}
else
{
isAuthentic = true;
}