-1
我正在我的应用程序上实现一个forgot_password类型的功能,我无法找到如何检查是否有任何返回的行。用户首先输入他/她的电子邮件,然后我搜索数据库,如果发现电子邮件进行,否则停止并告诉他们他们的电子邮件尚未找到;这是我的代码Java jdbc preparedstatements如何检查空行
Connection dbConnection=null;
dbConnection= DB.getConnection();
PreparedStatement preparedStatement= dbConnection.prepareStatement("Select email,password from profiles where email=?");
preparedStatement.setString(1, User_Email);
preparedStatement.executeQuery();
// This code is not working below empty null rows still say email found
if(preparedStatement==null)
{
return ok("Email not found");
}
else
{
return ok("Email Found");
}
的USER_EMAIL串正常工作,我已经验证,但似乎
preparedStatement时== NULL什么都不做
您需要检查的executeQuery返回值 – Marged
的可能的复制[如何获得与的executeQuery()在Java中的回报?](http://stackoverflow.com/questions/23986348/how-to- get-the-return-with-executequery-in-java) – Marged