public List ZhifuOrderInfo(String orderid) {
List<OrderInfo>list = new ArrayList();
try {
Connection con = DBUtil.getConnection();
String sql = "SELECT * FROM `orderinfo` WHERE `orderid` like "+orderid;
PreparedStatement pst = con.prepareStatement(sql);
ResultSet rs = pst.executeQuery();
while(rs.next()) {
OrderInfo oi = new OrderInfo();
oi.setOrderid(rs.getString(2));
oi.setGoodname(rs.getString(4));
oi.setPrice(rs.getString(5));
oi.setGoodtype(rs.getString(6));
oi.setNumber(rs.getString(7));
oi.setSum(rs.getString(8));
System.out.println("===========================");
System.out.println("orderid="+orderid);
System.out.println(oi.getGoodname()+"zhifu");
System.out.println(oi.getOrderid()+"zhifu");
System.out.println("===========================");
我觉得一般都是rs.hasnext(),不然的话不是最后一条没了,而是第一条直接被你跳过去了。
--------------------编程问答--------------------
String sql = "SELECT count(*) FROM `orderinfo` WHERE `orderid` like "+orderid; 你查查数据有多少条,我觉得的数据就两条可能
--------------------编程问答--------------------