我無法爲特定類的所有函數使用的DB字段類型聲明枚舉。用下面的代碼我得到「無法解析USERNAME給一個變量類型」:跨類使用的Java枚舉
public class SQL_access {
public enum DBfields { BLANK, USERNAME, ID, PASSWORD, FIRSTNAME, LASTNAME };
public boolean loginValidate(String username, String password){
String DBuser, DBpass;
PreparedStatement table = connectToTable("firstsql", "users");
ResultSet row = table.executeQuery();;
while(row.next()){
DBuser = row.getString(USERNAME);
if(DBuser.equals(username)){
DBpass = row.getString(PASSWORD);
break;
}
}
}
};
這工作完美,謝謝! – Austin 2012-07-13 14:53:33