I'm trying to make to the database checks whether the data already exists, before the new data input. but always fail By "SQLException Not Allowed Empty Result Set" if want input the new data / In the database there is no double data. please its support.
Thank you.

This My Code :
private void btnSimpanActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:  
        String nopas = (txtNopas.getText());
       //Command For Check if Data already in database
       try {
        Connection c = KoneksiMySql.getKoneksi();
        Statement s = c.createStatement();
        String sql = "select status, unit from pasiendaftar where nopasien='"+nopas+"'";
        ResultSet r = s.executeQuery(sql);       
        r.first();
        String status = r.getString(1);
        String unit = r.getString(2);
    if (status.equals("P")) {
        JOptionPane.showMessageDialog(null, "Pasien Masih Melakukan Transaksi : " + unit
                +"\nHarap Menyelesaikan Transaksi Terlebih Dahulu",
        "Pesan Error", JOptionPane.ERROR_MESSAGE);
    }else {
        //Command for new Input Data
            String klmn;
        if(jcbLaki.isSelected()){
            klmn = jcbLaki.getText();
        }else {
            klmn = jcbPerempuan.getText();
        }        
        String nop = txtNopas.getText(); 
        String nama = inputNama.getText();
        java.util.Date tanggalLahir = (java.util.Date) tglInput.getDate();
        String jns = klmn;
        String alamat = inputAlamat.getText();
        String iden = inputIdentitas.getText();
        String jnsIden = (String) jcbIdentitas.getSelectedItem();
        String agama= (String) jcbAgama.getSelectedItem();
        String penjamin = (String) jcbPenjamin.getSelectedItem();
        String ats = inputAtsNma.getText();
        String tlp = inputNoTlp.getText();
 
        try {
            Connection d = KoneksiMySql.getKoneksi();
            String my = "update pasien set nama=?, tgl_lahir=?, jns_kelamin=?, alamat=?, no_identitas=?,"
                    +" jns_identitas=?, agama=?, penjamin=?, ats_nama=?, no_telp=? where nopasien=?";
            PreparedStatement p = d.prepareStatement(my);            
 
            p.setString(1, nama);
            p.setDate(2, new java.sql.Date(tanggalLahir.getDate()));
            p.setString(3, jns);
            p.setString(4, alamat);
            p.setString(5, iden);
            p.setString(6, jnsIden);
            p.setString(7, agama);
            p.setString(8, penjamin);
            p.setString(9, ats);
            p.setString(10, tlp);
            p.setString(11, nop);
 
            p.executeUpdate();
            p.close();
            JOptionPane.showMessageDialog(null, "Data Tersimpan",
                    "Pemberitahuan", JOptionPane.INFORMATION_MESSAGE);
        } catch(SQLException e) {
            System.out.println("Error : " + e);
            JOptionPane.showMessageDialog(null, "Pendaftaran Pasien Gagal",
                    "Pesan Error", JOptionPane.ERROR_MESSAGE);
        }finally {
            dafpas();
            //Memanggil Form Pendaftaran Baru
            this.dispose();
            CariPasien ob = new CariPasien();
            WindowMaster.panel.add(ob);
            ob.show();
        }
        }r.close();
        }catch (SQLException e){
           System.out.println("Error Pasien Double Cek : " + e);
        }
    }