日期:2014-05-20  浏览次数:20779 次

【求解】从数据库复制资料到数组中失败
本帖最后由 amuletx 于 2013-11-10 21:49:32 编辑

private ArrEvent record;
public ArrEvent getAllRecord() {
        try{
        String sql = "select * from " + tableNameEvent;
        ResultSet rs = stmt.executeQuery(sql);
        conn.commit(); 
        conn.setAutoCommit(true);
        ArrayList<Event> Event_list = new ArrayList<Event>();
        while (rs.next()) {
           Event_list.add(new Event(rs.getInt("EVENTCODE"), rs.getString("EVENTTYPE"), rs.getString("TITLE"), rs.getString("FACILITATOR"), rs.getString("LOCAION"), rs.getString("DATE"), rs.getString("TIME"), rs.getInt("MAX_PARTICIPANTS"), rs.getInt("NUM_PARTICIPANTS"), rs.getDouble("FEE")));
        }
        
        
            Event[] Arr_Event = new Event[Event_list.size()];
       
            for (int i = 0; i < Event_list.size(); i++) {
                Arr_Event[i] = Event_list.get(i);
            }
            record=new ArrEvent(Arr_Event,Event_list.size());
            System.out.println(Arr_Event[0]);
        }catch(SQLException ex){
            
        }
        
        return record;
    }

------解决方案--------------------
报的什么错?贴出来看下
------解决方案--------------------
直接把异常贴出来,图片字看不清