标题:数据库小问题
只看楼主
新手上路了
Rank: 1
等 级:新手上路
威 望:2
帖 子:107
专家分:0
注 册:2008-3-27
结帖率:100%
 问题点数:0 回复次数:0 
数据库小问题
public ArrayList getAllCatalogs() {
        ArrayList result = new ArrayList();
        PreparedStatement ps = null;
        try {
            ps = (PreparedStatement)DbUtil.getConnection().createStatement();
            ResultSet rs = (ResultSet) ps.executeQuery("select * from catalog");
            while(rs.next()){
                Catalog catalog = new Catalog();
                catalog.setId(rs.getInt("id"));
                catalog.setName(rs.getString("name"));
                result.add(catalog);
            }
            ps.close();
        } catch (SQLException ex) {
            Logger.getLogger(CatalogDaoImpl.class.getName()).log(Level.SEVERE, null, ex);
        }
        return result;
    }
这方法有什么问题?  调用类已测试正确
搜索更多相关主题的帖子: 数据库 catalog ArrayList Catalog ResultSet 
2008-07-28 17:05



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-225596-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.900728 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved