The ResultSet rs=null;
//to get connection object
The Connection Connection=Basedao. Getconn ();
PreparedStatement pStatement=null;
Try {
If (keyword!=null) {
String SQL="select * from the user where user_name like? The order by user_birthday desc limit? That?" ;
PStatement=connection. PrepareStatement (SQL);
PStatement. SetString (1, "%" + keyword + "%");
PStatement. SetInt (2, (cpage - 1) * count);
PStatement. SetInt (3, count);
} else {
String SQL="select * from user order by user_birthday desc limit? That?" ;
PStatement=connection. PrepareStatement (SQL);
PStatement. SetInt (1, (cpage - 1) * count);
PStatement. SetInt (2, count);
}
Rs=pStatement. ExecuteQuery ();
System. The out. Print (1);
While (rs), next ()) {
System. The out. Print (2);
Sport_user user=new sport_user (
Rs. Get string (" user_id "),
Rs. Get string (" user_name "),
Rs. Get string (" user_pwd "),
User_sex rs. Get string (" "),
User_birthday rs. Get string (" "),
User_moible rs. Get string (" "),
User_idenity rs. Get string (" "),
Rs. Get int (" user_status ")
);
System. The out. Print (0);
System. The out. Print (user);
list.add(user);
};
System. The out. Print (3);
} the catch (Exception e) {
//TODO: handle the exception
} the finally {
System. The out. Print (4);
Basedao. Closeall (rs, pStatement, connection).
}
System. The out. Print (5);
return list;
}
CodePudding user response:
To print only 1234, illustrate the rs collection without the data, you can try to output the rs collection of size, can also according to the parameters passed, execute SQL statements directly to the data, look at what the output recordCodePudding user response:
No 3 that you must fetch the data from the rs error when you need the bai, you catch exceptions to play out and have a lookCodePudding user response:
} the catch (Exception e) {
//TODO: handle the exception
e.printStackTrace();
}
The exception
CodePudding user response:
The debug a open don't know you have the wrong, also have been printCodePudding user response: