Guest User

Untitled

a guest
Jan 8th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. int dialogResult = JOptionPane.showConfirmDialog (null, "Would You Like to put the --?","Warning",JOptionPane.YES_NO_OPTION);
  2. if(dialogResult == JOptionPane.YES_OPTION){
  3. try{
  4.  
  5. TableModel mode = table.getModel();
  6.  
  7.  
  8. String companycode = mode.getValueAt(table.getSelectedRow(), 0).toString();
  9. String employeeid = mode.getValueAt(table.getSelectedRow(), 1).toString();
  10. String firstname = mode.getValueAt(table.getSelectedRow(), 2).toString();
  11. String surname = mode.getValueAt(table.getSelectedRow(), 3).toString();
  12. String designation = mode.getValueAt(table.getSelectedRow(), 4).toString();
  13. String contact = mode.getValueAt(table.getSelectedRow(), 5).toString();
  14.  
  15. String date = jMenuDate.getText();
  16. String time = jMenuTime.getText();
  17.  
  18. Connection conn;
  19. PreparedStatement pst;
  20.  
  21. Class.forName("com.mysql.jdbc.Driver");
  22. conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/employeesy2s", "name", "passcode") ;
  23. pst=conn.prepareStatement("insert into marking_attendance values(?,?,?,?,?,?,?,?)");
  24.  
  25. pst.setString(1, companycode);
  26. pst.setString(2, employeeid);
  27. pst.setString(3, firstname);
  28. pst.setString(4, surname);
  29. pst.setString(5, designation);
  30. pst.setString(6, contact);
  31. pst.setString(7, date);
  32. pst.setString(8, time);
Add Comment
Please, Sign In to add comment