我有一个ClientsTable
这样的:
firstName lastName address idNumber userName password
| | | | |
david bowie here 123 mick jagger
chuck norris there 456 steven seagal
我想同时获取每一行的 theuserName
和 thepassword
并使用我的方法的给定参数对其进行验证:
public Person verifyClientExists(String username,String password) throws SQLException
{
ResultSet results = this.m_statement.executeQuery("SELECT `userName` FROM `ClientsTable`");
while (results.next() == true)
{
// here I want to compare the retrieved data from
// mysql with the "username" and "password" given in the prototype
}
return null;
}
但是根据我当前的查询,我只能得到一个字段。
如何检索两个字段?