我有一个表一次显示一行,即在第一次迭代中它将给出一行信息和第二次迭代,依此类推。现在我想获得结果集中的所有行数据。我怎么能这样做?
这是我桌子的结构:
name s e p f
Allan 2 3 8 9
我在做:
rsServeResource6 = st.executeQuery(sqlForIndividualMileStone);
while(rsServeResource6.next()){
if(rsServeResource6.getString(2)!=null){
engageActual = Integer.parseInt(rsServeResource6.getString(2));
System.out.println("Results :"+engageActual);
}else if(rsServeResource6.getString(3)!=null){
qualificationActual = Integer.parseInt(rsServeResource6.getString(3));
System.out.println("Results :"+qualificationActual);
}else if(rsServeResource6.getString(4)!=null){
isSubmissionActual = Integer.parseInt(rsServeResource6.getString(4));
System.out.println("Results :"+isSubmissionActual);
}else if(rsServeResource6.getString(5)!=null){
presentActual = Integer.parseInt(rsServeResource6.getString(5));
System.out.println("Results :"+presentActual);
}else if(rsServeResource6.getString(6)!=null){
interviewActual = Integer.parseInt(rsServeResource6.getString(6));
System.out.println("Results :"+interviewActual);
}
}
像那样。
我怎样才能实现?
答案 0 :(得分:1)
在获取结果时使用if
而不是else if