为什么不执行while(rs.next)
publicList<One_collections>getCollections_news(intType,Stringtitle,Stringname,Stringa...
public List<One_collections> getCollections_news(int Type, String title,
String name, String addDate) {
// TODO Auto-generated method stub
String sql = "select oc.ID,onn.title,oc.Type,od.name,oc.addDate "
+ " from one_collections oc,one_news onn,one_ddh od "
+ " where oc.ddhId=od.ID and oc.itemId=onn.Id and oc.Type="+Type
+" and onn.title like '%"+title+"%' and od.name='"+name+"' and oc.addDate>='"
+addDate+" 00:00:00' and oc.addDate<= '"+addDate+" 23:59:59'";
ResultSet rs = help.execQuery(sql);
List<One_collections> list = new ArrayList<One_collections>();
try {
System.out.println(sql);
if(rs==null){
System.out.println("null");
}else{
System.out.println("not null");
}
while (rs.next()) {
System.out.println("why?");
One_collections oc = new One_collections();
oc.setID(rs.getInt(1));
One_news onn = new One_news();
onn.setTitle(rs.getString(2));
oc.setOnn(onn);
oc.setType(rs.getInt(3));
One_ddh od = new One_ddh();
od.setName(rs.getString(4));
oc.setOd(od);
oc.setAddDate(rs.getString(5));
list.add(oc);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
} 展开
String name, String addDate) {
// TODO Auto-generated method stub
String sql = "select oc.ID,onn.title,oc.Type,od.name,oc.addDate "
+ " from one_collections oc,one_news onn,one_ddh od "
+ " where oc.ddhId=od.ID and oc.itemId=onn.Id and oc.Type="+Type
+" and onn.title like '%"+title+"%' and od.name='"+name+"' and oc.addDate>='"
+addDate+" 00:00:00' and oc.addDate<= '"+addDate+" 23:59:59'";
ResultSet rs = help.execQuery(sql);
List<One_collections> list = new ArrayList<One_collections>();
try {
System.out.println(sql);
if(rs==null){
System.out.println("null");
}else{
System.out.println("not null");
}
while (rs.next()) {
System.out.println("why?");
One_collections oc = new One_collections();
oc.setID(rs.getInt(1));
One_news onn = new One_news();
onn.setTitle(rs.getString(2));
oc.setOnn(onn);
oc.setType(rs.getInt(3));
One_ddh od = new One_ddh();
od.setName(rs.getString(4));
oc.setOd(od);
oc.setAddDate(rs.getString(5));
list.add(oc);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询