WHY WHEN I EXECUTE THE BELOW CODE I GETS AN EXCEPTION java.sql.SQLException: No ResultSet was produced.........BUT EVEN THOUGH INSERTION OPERATION WORKS FINE........CAN ANYONE TELL ME WHY THIS EXCEPTION COMES
Connection co;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
co = DriverManager.getConnection("jdbc:odbc:hh");
Statement st1;
ResultSet result;
st1 = co.createStatement();
result=st1.executeQuery("select count(*) from rooms");
result.next();
int cn = result.getInt(1);
System.out.println("count"+cn);
String depart = (String) dept1.getSelectedItem();
if("Others".equals(depart))
{
cn++;
st1.executeQuery("insert into rooms (room_number, serial, depart) values('"+room_no1.getText()+"','"+cn+"','"+others1.getText()+"')");
}
st1.close();
} catch (Exception ex) {System.out.print(ex);}