private void emailKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_emailKeyReleased
        String eMail = email.getText();

        if(eMail.matches("^[_A-Za-z0-9-]+(\\\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+\n" + "(\\\\.[A-Za-z0-9]+)*(\\\\.[A-Za-z]{2,})$")){
            try{
                String sql = "select rowid from Employee where email = '" + eMail + "'";
                conn = DBConnect.connect();
                pst = conn.prepareStatement(sql);
                rs = pst.executeQuery();
                if(rs.next()){
                    JOptionPane.showMessageDialog(null, "Email must be UNIQUE!");
                    empNo.setText("");
                }
            }
            catch(Exception e){
                JOptionPane.showMessageDialog(null, e);
            }
            finally{
                if(pst != null){
                    try{
                        pst.close();
                    }
                    catch(SQLException ex){
                        JOptionPane.showMessageDialog(null, ex);
                    }
                }
                if(rs != null){
                    try{
                        rs.close();
                    }
                    catch(SQLException ex){
                        JOptionPane.showMessageDialog(null, ex);
                    }
                }
                if(conn != null){
                    try{
                        conn.close();
                    }
                    catch(SQLException ex){
                        JOptionPane.showMessageDialog(null, ex);
                    }
                }
            }
        }
    }