我需要以下错误的帮助.下面是方法retrievePassword().我对它进行了编程,以便在调用Clickid时,我也可以检索所有其他数据.
public boolean retrievePassword() {
// declare local variables
boolean success = false;
ResultSet rs = null;
DBController db = new DBController();
// step 1 of using DBController, passing data source name setup during last practical
db.setUp("myDatabase");
// declare the SQL
String dbQuery = "SELECT Clickid FROM PROFILE WHERE Clickid = '" + clickId + "'" ;
// step 2 of using DBCcontroller, for retrieve SQL use readRequest method
rs = db.readRequest(dbQuery);
try{
if (rs.next()){
firstName = rs.getString("Firstname");
lastName = …Run Code Online (Sandbox Code Playgroud) 我很难将多个结果集存储到ArrayList中.我还需要在JTextArea中显示它们.但问题是,我不能让它显示任何东西.
public static ArrayList<Wall> getWallPosts(int postId){
ArrayList<Wall> postList = new ArrayList<Wall>();
ResultSet rs = null;
DBController db = new DBController();
db.setUp("myDatabase");
String dbQuery = "SELECT Id FROM Wall WHERE ID ="+postId;
rs = db.readRequest(dbQuery);
try{
while (rs.next()){
int wallId = rs.getInt("Id");
String wallPoster = rs.getString("Poster");
String wallPost = rs.getString("Post");
String wallDate = rs.getString("Tdate");
Wall w1 = new Wall(wallPoster, wallPost , wallDate);
postList.add(w1);
}
}
catch (Exception e) {
e.printStackTrace();
}
db.terminate();
return postList;
}
//The method for displaying the result …Run Code Online (Sandbox Code Playgroud)