I'm trying to execute a query and store the result in the result set named 'objRs'. In evaluating an if statement, 'objRs' is evaluated as 'true', and the code withing if the if block gets executed. But in the statement below it, 'objRs' is coming as 'false'.
See the below code for a clearer picture:
if (objRs!= null && objRs.next()) //the statements in this block is //executed
{
user_Name = objRs.getString("login_name");
user_id = objRs.getString("user_id");
corp_id = objRs.getString("corp_id");
corp_grp_id = objRs.getString("corporate_group");
f_name = objRs.getString("first_name");
l_name = objRs.getString("last_name");
moNumber = objRs.getString("cont_mobile");
gender = objRs.getString("gender");
address = objRs.getString("address");
city = objRs.getString("b_adr1_city");
state = objRs.getString("b_adr1_state");
country = objRs.getString("b_adr1_country");
}
}
@SuppressWarnings("unused")
Boolean test = objRs.next(); //the value of test is showing //as 'false' while debugging.
The above code is part of a 'try' block.
Please suggest a solution such that the 'objRs' doesn't become 'false' in the above case.