テーブル内のデータとフレーム内のデータを比較してコンボボックスにロードしようとしていますが、コードを実行するたびに次のエラー メッセージが表示されます。助けてください:これは私のデータベースクラスのコードです
public ArrayList allocateStaffcombobox(Allocation aloc) throws SQLException
{
ArrayList<Allocation> vec = new ArrayList<Allocation>();
String sql = "select * from staffsubalocation where SubCode='"+aloc.getSubjCode()+"'";
ResultSet result = stmt.executeQuery(sql);
while (result.next())
{
String staffNo = result.getString("StaffNo");
String subcode=result.getString("SubCode");
System.out.println(staffNo+" "+ subcode);
vec.add(new Allocation(staffNo,subcode));
}
return vec;
}
これは私のJavaクラスのコードです:
public void loadStaffCombo()
{
try
{
DatabaseManager db = new DatabaseManager();
ArrayList<Allocation> sub=db.allocateStaffcombobox(null);
Staffcombobox.removeAllItems();
// String firsIndex = " ";
for(int x = 0; x< sub.size(); x++)
{
Staffcombobox.addItem( sub.get(x).getStaffNo());
}
}
catch (SQLException ex)
{
Logger.getLogger(ViewSubjectsJInternalFrame.class.getName()).log(Level.SEVERE, null, ex);
}
}