问题描述
- 为什么没有输出任何东西
- @Test
public void testResetMetData() throws Exception{
Connection conn=null;
PreparedStatement preparedStatement=null;
ResultSet rs=null;try { String sql=""select id stu_ididCard stu_idcardexamCard stu_examcardscore stu_score "" +""from examstudent where id=?""; conn=JDBCTools.getConnection(); preparedStatement=conn.prepareStatement(sql); preparedStatement.setInt(14); rs=preparedStatement.executeQuery(); Map<StringObject> values=new HashMap<StringObject>(); ResultSetMetaData rsmd=rs.getMetaData(); while(rs.next()){ for(int i=0;i<rsmd.getColumnCount();i++){ String columnLabel=rsmd.getColumnLabel(i+1); System.out.println(columnLabel); } } //打印列名 //System.out.println(values); Class clazz=Student.class; Object object=clazz.newInstance(); for(Map.Entry<String Object> entry:values.entrySet()){ String fieldName=entry.getKey(); Object fieldValue=entry.getValue(); System.out.println(fieldName+"":""+fieldValue); } } catch (SQLException e) { e.printStackTrace(); }finally{ JDBCTools.releaseDB(rs preparedStatement conn); }}
解决方案
这是Junit单元测试吧,那么有没有异常信息呢,测试结果为红杠还是绿杠呢?
解决方案二:
什么都没有看下有没报错,,
时间: 2024-12-02 08:41:32