大家给我看看这有错误吗 怎么list里面就没有值呀??
public List<Zc>geren(String username) {Zc zc = null;
List<Zc> list = new ArrayList<Zc>();
conn = Base.getInstance().getConnection();
try {
ps = conn.prepareStatement("SELECT * FROM userinfo where UserName=?");
ps.setString(1, username);
rs = ps.executeQuery();
while (rs.next()) {
zc = new Zc();
zc.setName(rs.getString("UserName"));
zc.setPassword(rs.getString("Password"));
zc.setTruename(rs.getString("RealName"));
zc.setId(rs.getString("IdentityCard"));
zc.setGuojia(rs.getString("Country"));
zc.setChengshi(rs.getString("City"));
zc.setAddress(rs.getString("Address"));
zc.setPostCode(rs.getString("Zip"));
zc.setPhone(rs.getString("Phone"));
zc.setEmail(rs.getString("Email"));
list.add(zc);
}
rs.close();
ps.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}