0
我想從數據庫中的作用變量的值,我得到錯誤「未處理的異常類型的SQL異常」無法從數據庫中檢索得到的錯誤爲「未處理的異常類型的SQL異常」
static int indexValue=0;
public static int getRole(IndexBean w){
String elid= IndexBean.getId();
conn = ConnectionProvider.getCon();
Statement statement = conn.createStatement();
ResultSet resultset = statement.executeQuery("SELECT role FROM users WHERE elid = '" + elid + "'") ;
String role = resultset.getString(1);
if(role=="ADMIN"){
indexValue = 1;
}else if(role=="analyst"){
indexValue = 2;
}
conn.close();
return indexValue;
}
}
無關,但:'作用== 「ADMIN」'是不是做了什麼,你認爲它。 –