Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String cas = txtcas.getValue().toString();
- String anu = txtanu.getValue().toString();
- String med = txtmed.getValue().toString();
- String year = txtyear.getText();
- try {
- int c;
- Class.forName("com.mysql.jdbc.Driver");
- con = DriverManager.getConnection("jdbc:mysql://localhost/spay","root","");
- PreparedStatement pst1 = con.prepareStatement("select empno from registation");
- ResultSet rs = pst1.executeQuery();
- String empNoValue1 = rs.getString("empno");
- PreparedStatement pst2 = con.prepareStatement("select empno from leaves");
- String empNoValue = rs.getString("empno");
- ResultSet rs1 = pst2.executeQuery();
- while (rs.next()) {
- if(rs1.next())
- {
- if(empNoValue1.equals(empNoValue))
- {
- }
- }
- else
- {
- pst = con.prepareStatement("insert into leaves(empno,casual,annual,medical,year)values(?,?,?,?,?)");
- pst.setString(1,empNoValue); // employee no how to give
- pst.setString(2, cas);
- pst.setString(3, anu);
- pst.setString(4, med);
- pst.setString(5, year);
- pst.executeUpdate();
- }
- }
- JOptionPane.showMessageDialog(null,"Leave Insertedddddd");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement