我在声明可以在特定类的所有函数中使用的 DB 字段类型的枚举时遇到问题。使用以下代码,我得到“无法将 USERNAME 解析为变量类型”:
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;
}
}
}
};