问答详情
源自:2-3 JDBC实战---搭建模型层 Ⅰ

求助老师和大神

http://img.mukewang.com/54fec84c0001d10c05890218.jpg主要是GoddessDao类里面query函数的问题!  

public List<Goddess> query() throws SQLException{

Connection conn = DBUdil.getConnection();

Statement stmt = conn.createStatement(); 

ResultSet rs = stmt.executeQuery("select user_name from imooc_goddess");

List<Goddess> gs=new ArrayList<Goddess>();

Goddess g = null;

while(rs.next())

{

g = new Goddess();

g.setUser_name(rs.getString("user_name"));

g.setAge(rs.getInt("age"));

gs.add(g);

}

return gs;

}


提问者:gb风起云淡 2015-03-10 18:35

个回答

  • 没有马甲线的安琪拉
    2015-03-10 19:41:16

    错误提示是没有age列,查一下数据库列是否匹配