// Write Connectivity Code here properly/globally.

private void jBtnRegSearchActionPerformed(java.awt.event.ActionEvent evt) 
{  
        String gender = "";
        String ChkMatric = "";
        String ChkInter = "";
        String ChkGrad = "";
        String ChkPg = "";
        
        try
          {            
            pst=conn.prepareStatement("select * from REGISTRATION where REGUNAME='"+
                jTxtRegUname.getText().trim()+"'");
            rs= pst.executeQuery();
            while (rs.next())
              {
                jTxtRegSlno.setText(rs.getString("REGSLNO"));
                jTxtRegName.setText(rs.getString("REGNAME"));
                jTxtRegFname.setText(rs.getString("REGFNAME"));
                 //Date pp = new SimpleDateFormat("dd-MMM-yyyy").parse(rs.getString("REGDOB"));
                jDtRegDob.setDate(new SimpleDateFormat("dd-MMM-yyyy").parse(rs.getString("REGDOB")));
                
                gender = rs.getString("REGGENDER");
                if(gender.equals("Male"))
                  {
                    jRdbRegMale.setSelected(true);
                  }
                else if (gender.equals("Female"))
                  {
                    jRdbRegFemale.setSelected(true);
                  }
                else if (gender.equals("Other"))
                  {
                    jRdbRegMale.setSelected(true);
                  }
                else 
                  {
                    jRdbRegMale.setSelected(false);
                    jRdbRegFemale.setSelected(false);
                    jRdbRegOther.setSelected(false);
                  }
                 
                ChkMatric = rs.getString("REGMATRIC");
                if (ChkMatric.equals("Matric"))
                  {
                    jChkRegMatric.setSelected(true);
                  }
                else 
                  {
                    jChkRegMatric.setSelected(false);
                  }

                ChkInter = rs.getString("REGINTER");
                if (ChkInter.equals("Inter"))
                 {
                    jChkRegInter.setSelected(true);
                 }
                else 
                 {
                    jChkRegInter.setSelected(false);
                 }

                ChkGrad = rs.getString("REGGRAD");
                if (ChkGrad.equals("Graduation"))
                 {
                    jChkRegGrad.setSelected(true);
                 }
                else 
                 {
                    jChkRegGrad.setSelected(false);
                 }

                ChkPg = rs.getString("REGPG");
                if (ChkPg.equals("PG"))
                  {
                    jChkRegPg.setSelected(true);
                  }
                else 
                  {
                    jChkRegPg.setSelected(false);
                  }

                jTxtRegMobile.setText(rs.getString("REGMOBILE"));
                jTxtRegEmail.setText(rs.getString("REGEMAIL"));
                jCmbRegState.setSelectedItem(rs.getString("REGSTATE"));
                jRtbRegAddress.setText(rs.getString("REGADDRESS"));
                jTxtRegUname.setText(rs.getString("REGUNAME"));
                jPdRegPsd.setText(rs.getString("REGPSD"));
              }            
         }
        catch(Exception e)
         {
           System.out.println(e) 
         }
}

 366 total views,  1 views today

Categories: Java Project

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.