lessonInfos=new ArrayList(); Connection con = null; PreparedStatement pre = null; ResultSet rs=null; DBcon conns = new DBcon(); con = conns.getConnection(); try { pre=con.prepareStatement("SELECT ? FROM lessoninfo"); pre.setString(1, date); rs=pre.executeQuery(); while(rs.next()){ System.out.println(rs.getString(date)); LessonInfo lessonInfo=new LessonInfo(); String[] result = rs.getString(date).split("\\."); if(result.length == 2){ lessonInfo.setLessonName(result[0]); lessonInfo.setLessonTime(result[1]); } lessonInfos.add(lessonInfo); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ try { con.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return lessonInfos;}
servlet打印mysql语句_servlet连接mysql数据库,通过查询语句得到的结果集,打印之后发现不正确。...
最新推荐文章于 2022-03-15 14:24:12 发布