当前光标位置(JBDC)的无效操作

时间:2021-06-17 20:30:53
private void updateActionPerformed(java.awt.event.ActionEvent evt) {                                       

     String id_col=studid.getText();
     String last_name=lastname.getText();
     String first_name=firstname.getText();
     String course=cr.getText();
     String school=sc.getText();
     String GPA=gpa.getText();
     String SCHOLARSHIP=scholar.getText();

     int newID = Integer.parseInt(id_col);
     double GPa=Double.parseDouble(GPA);
     int scholars=Integer.parseInt(SCHOLARSHIP);

          try{

         rs.updateRow();
         rs.updateInt("STUDENT_ID", newID);
         rs.updateString("LAST_NAME", last_name);
         rs.updateString("FIRST_NAME", first_name);
         rs.updateString("COURSE", course);
         rs.updateString("SCHOOL", school);
         rs.updateDouble("GPA", GPa);
         rs.updateInt("SCHOLARSHIP", scholars);




         JOptionPane.showMessageDialog(STUDENSCHOLARSHIP.this,"UPDATED");

     }  
     catch(SQLException err){
         System.out.println(err.getMessage());

     }

  fetch();
    }   

i try if(rs.next()){} but it wont work . help me pls..:(

我尝试if(rs.next()){}但它不会工作。帮我吧.. :(

1 个解决方案

#1


1  

rs.updateRow () must be called after you have updated your columns.

更新列后必须调用rs.updateRow()。

#1


1  

rs.updateRow () must be called after you have updated your columns.

更新列后必须调用rs.updateRow()。