Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int dialogResult = JOptionPane.showConfirmDialog (null, "Would You Like to put the --?","Warning",JOptionPane.YES_NO_OPTION);
- if(dialogResult == JOptionPane.YES_OPTION){
- try{
- TableModel mode = table.getModel();
- String companycode = mode.getValueAt(table.getSelectedRow(), 0).toString();
- String employeeid = mode.getValueAt(table.getSelectedRow(), 1).toString();
- String firstname = mode.getValueAt(table.getSelectedRow(), 2).toString();
- String surname = mode.getValueAt(table.getSelectedRow(), 3).toString();
- String designation = mode.getValueAt(table.getSelectedRow(), 4).toString();
- String contact = mode.getValueAt(table.getSelectedRow(), 5).toString();
- String date = jMenuDate.getText();
- String time = jMenuTime.getText();
- Connection conn;
- PreparedStatement pst;
- Class.forName("com.mysql.jdbc.Driver");
- conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/employeesy2s", "name", "passcode") ;
- pst=conn.prepareStatement("insert into marking_attendance values(?,?,?,?,?,?,?,?)");
- pst.setString(1, companycode);
- pst.setString(2, employeeid);
- pst.setString(3, firstname);
- pst.setString(4, surname);
- pst.setString(5, designation);
- pst.setString(6, contact);
- pst.setString(7, date);
- pst.setString(8, time);
Add Comment
Please, Sign In to add comment