Update Table

  private void update_table() {
        try {
            String sql = "select * from Employeeinfo";
            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery();
            tbl_employee.setModel(DbUtils.resultSetToTableModel(rs));
        } catch (SQLException ex) {
            Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }


for DbUtils.resultSetToTableModel(rs) need to add jar file of  rs2xml.jar

and then
   Connection conn = null;
    ResultSet rs = null;
    PreparedStatement pst = null;

    /**
     * Creates new form NewJFrame
     */
    public NewJFrame() {
        initComponents();
        conn = javaconnect.ConnecrDB();        update_table();    }

No comments:

Post a Comment