0
得到一個結果我有一個ResultSet
對象如何從外部Java類
ResultSet theInfo = stmt.executeQuery(sqlQuery);
,但我希望有一個可以從另一個Java類
public Vector loadStuff(){
try {
while (theInfo.next()){
aVector.addElement(new String(theInfo.getString("aColumn"))); // puts results into vectors
}
} catch (SQLException e) {
e.printStackTrace();
}
return aVector;
}
我調用的函數不完全確定如何去做這件事。我想要一些如何調用返回填充矢量的無效方法。這可能嗎?
將向量作爲參數傳遞。 –
爲什麼不使用[DAO方法](http://www.tutorialspoint.com/design_pattern/data_access_object_pattern.htm)? –