Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. String cas = txtcas.getValue().toString();
  2. String anu = txtanu.getValue().toString();
  3. String med = txtmed.getValue().toString();
  4. String year = txtyear.getText();
  5.  
  6. try {
  7. int c;
  8. Class.forName("com.mysql.jdbc.Driver");
  9. con = DriverManager.getConnection("jdbc:mysql://localhost/spay","root","");
  10. PreparedStatement pst1 = con.prepareStatement("select empno from registation");
  11. ResultSet rs = pst1.executeQuery();
  12. String empNoValue1 = rs.getString("empno");
  13. PreparedStatement pst2 = con.prepareStatement("select empno from leaves");
  14. String empNoValue = rs.getString("empno");
  15. ResultSet rs1 = pst2.executeQuery();
  16.  
  17. while (rs.next()) {
  18.  
  19. if(rs1.next())
  20.  
  21. {
  22. if(empNoValue1.equals(empNoValue))
  23. {
  24.  
  25. }
  26.  
  27.  
  28.  
  29. }
  30. else
  31. {
  32.  
  33. pst = con.prepareStatement("insert into leaves(empno,casual,annual,medical,year)values(?,?,?,?,?)");
  34. pst.setString(1,empNoValue); // employee no how to give
  35. pst.setString(2, cas);
  36. pst.setString(3, anu);
  37. pst.setString(4, med);
  38. pst.setString(5, year);
  39. pst.executeUpdate();
  40. }
  41.  
  42.  
  43.  
  44. }
  45. JOptionPane.showMessageDialog(null,"Leave Insertedddddd");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement