我把sql语句在数据库里面查过了 能查出来数据
ps = con.prepareStatement("select * from position where name='"+pos+"'");
re = ps.executeQuery();
System.out.println(re.next()); // 为false
while (re.next()) {
position = new Position();
position.setId(re.getInt("id"));
position.setNumber(re.getString("number"));
position.setName(re.getString("name"));
position.setLongitude(re.getString("longitude"));
position.setLatitude(re.getString("latitude"));
position.setLdatetime(re.getString("ldatetime"));
positionl.add(position);
System.out.println(positionl.size());
}
查询的条件是一个数组,是循环的,但是每循环一次只有一条符合条件 。但是走到while(){}
就进不去 显示false。难道只有一条数据进不去吗?不可能吧, 以前没有遇到过这种情况。。
你调用了一下
next
方法,游标往下走了,只有一条的情况下,while
肯定不走了。。