我正在使用JAVA与Oracle 10g合作,我试图计算出以下代码,但它继续显示" Exhausted Resultset" ..有谁知道我怎样才能获得正确的输出?任何与此相关的帮助将不胜感激......
ResultSet rs = stmt.executeQuery("select * from ATTENDANTS");
ResultSet rs2 = stmt.executeQuery("select * from ATTENDANCE");
String insert = ("INSERT INTO ATTENDANTS ( Attendant_Name, Attendant_Age, Attendant_Contact_No, Attendant_Department_Name, REGISTRATION_NUM) VALUES('" + naam + "','" + umar + "','" + number + "', '" + deprt + "' , '" + registration + "')");
String insert2 = ("INSERT INTO ATTENDANCE ( Attendant_Name, Attendant_Age, Attendant_Contact_No, Attendant_Department_Name, REGISTRATION_NUM) VALUES('" + naam + "','" + umar + "','" + number + "', '" + deprt + "' , '" + registration + "')");
//ResultSetMetaData rsmd = rs.getMetaData();
//boolean colname = rsmd.equals(rs.getString(1));
while(rs.next() || rs2.next()){
int a = naam.compareTo(rs.getString(1));
int b = naam.compareTo(rs2.getString(1));
int c = registration.compareTo(rs.getString(5));
int d = registration.compareTo(rs2.getString(7));
if((naam.equals(rs.getString(1)) && name.equals(rs2.getString(1))) || (registration.equals(rs.getString(5)) && registration.equals(rs2.getString(7)))){
System.out.println("Record Already Exist");
JOptionPane.showMessageDialog(null, "Name already exists in Record");
//faceFrame.repaint();
System.out.println("Already EXISTS");
}
//else if((a == 0 && c == 0) || (b == 0 && d == 0)){
if((a == 0 && c == 0) || (b == 0 && d == 0)){
stmt.executeQuery(insert);
stmt.executeQuery(insert2);
System.out.println("INSERTION DONE");
}
//else
//System.out.println("Insertion Unsuccessfull");
}
}