返回顶部

一缕半夏微光

温柔半两,从容一生

导航

每日日报17

 今天在需要查询某些数据的时候,一直只能浏览一条数据

1 while (rs.next()) {
2 String title = rs.getString("title");
3 String content = rs.getString("content");
4 String time = rs.getString("time");
5 String createPeople = rs.getString("createPeople");
6 document = new Document(title, content, time, createPeople);
7 }
8 list.add(document);

后面我发现,是list.add()放错了地方,应该将list.add()放置在while(){}循环里面。

即正确的为:

1 while (rs.next()) {
2 String title = rs.getString("title");
3 String content = rs.getString("content");
4 String time = rs.getString("time");
5 String createPeople = rs.getString("createPeople");
6 document = new Document(title, content, time, createPeople);
7 list.add(document);
8 }

posted on 2021-09-23 23:05  一缕半夏微光  阅读(33)  评论(0编辑  收藏  举报