qian jianhua wrote:
 I'm sorry, but my following code again throws a SQLException, it can't pass through the "If(r1&&r2){}"statement. con.setAutoCommit(false);

           Statement stmt1=con.createStatement();
           String query1="select * from customer_binfo where customer_num="+customernum;
           ResultSet rs1=stmt1.executeQuery(query1);
           stmt1.close();

           Statement stmt2=con.createStatement();
           String query2="select * from customer where customer_num="+customernum;
           ResultSet rs2=stmt2.executeQuery(query2);
           stmt2.close();

           con.commit();
           con.setAutoCommit(true); 
           boolean r1=rs1.next();
           boolean r2=rs2.next();
           if (r1&&r2){             String gender=rs1.getString(2);
             int age=rs1.getInt(3);            ..... And the exception is:SQLException:S1010 [Microsoft][ODBC Driver Manager] Function sequence error 0 Who can tell me the reason?Thank you.


When you close a Statement the ResultSet associated with it automatically gets closed. So shift the stmt.close statements to after you operations are complete.
 

Reply via email to