0
public class UserBean<br>
{
public String name;
public String role;
}
class Dao{
ArrayList<UserBean> a = new ArrayList<UserBean>();
String sql = "Select * from user";
ResultSet rs = pStmt.executeQuery(sql);
while(rs.next()){
//----------Problem------------
// i want to do something like<br>
a.add[0].name = rs.getString("name");
a.add[0].role = rs.getString("role");
// Get column from resultset and set the value of userbean column
}
}
抱歉線沒有圖9是ArrayList的一個新= ArrayList的(); –