Click here to Skip to main content
15,891,687 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Java
Connection con;
PreparedStatement pstmt;

String sql = "INSERT INTO appraisalreport VALUES (?,?,?,?,?,?,?,?,?,?,?,?);";


try{
    Class.forName(DRIVER);
    
    con = DriverManager.getConnection(DB_URL, UNAME, PWD);
    
    pstmt = con.prepareStatement(sql);
    
    pstmt.setInt(1, new Integer(tfsn.getText()));
    pstmt.setString(2, tfdate.getText());
    pstmt.setString(3, tfap.getText());
    pstmt.setString(4, jTextField1.getText());
    pstmt.setInt(5, new Integer(jpunc.getText()));
    pstmt.setInt(6, new Integer(jattend.getText()));
    pstmt.setInt(7, new Integer(jteam.getText()));
    pstmt.setInt(8, new Integer(jsocial.getText()));
    pstmt.setInt(9, new Integer(jsmart.getText()));
    pstmt.setInt(10, new Integer(jtask.getText()));
    pstmt.setInt(11, new Integer(jtotal.getText()));
    pstmt.setString(12, jTextField9.getText());
                          
    int n = pstmt.executeUpdate();
    
    if(n > 0){
        javax.swing.JOptionPane.showMessageDialog(rootPane, "Appraisal successful !");
    }else{
        javax.swing.JOptionPane.showMessageDialog(rootPane, "Appraisal failed !");
    }
    
    pstmt.close();
    con.close();
    
}catch(ClassNotFoundException e){
    System.out.println("Driver not registered");
}catch(SQLException se){
    se.printStackTrace();
}
Posted
Updated 27-May-14 6:17am
v2
Comments
Richard MacCutchan 27-May-14 12:17pm    
So what is the problem?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900