// Write Connectivity code first here globally.
private void jBtnRegUpdateActionPerformed(java.awt.event.ActionEvent evt)
{
String gender = " ";
if(jRdbRegMale.isSelected())
{
gender="Male";
}
if(jRdbRegFemale.isSelected())
{
gender="Female";
}
if(jRdbRegOther.isSelected())
{
gender="Other";
}
String CmbState1 = (String)jCmbRegState.getSelectedItem();
String ChkMatric = "";
String ChkInter = "";
String ChkGrad = "";
String ChkPg = "";
if(jChkRegMatric.isSelected())
{
ChkMatric="Matric";
}
else
{
ChkMatric ="null";
}
if(jChkRegInter.isSelected())
{
ChkInter="Inter";
}
else
{
ChkInter ="null";
}
if(jChkRegGrad.isSelected())
{
ChkGrad="Graduation";
}
else
{
ChkGrad ="null";
}
if(jChkRegPg.isSelected())
{
ChkPg="PG";
}
else
{
ChkPg ="null";
}
Date dd=jDtRegDob.getDate(); //import java.util.Date;
Format xx= new SimpleDateFormat("dd-MMM-yyyy"); //import java.text.Format; & import
java.text.SimpleDateFormat;
String pp =xx.format(dd);
String TxtSlno = jTxtRegSlno.getText();
String TxtName = jTxtRegName.getText();
String TxtFname = jTxtRegFname.getText();
String TxtMobile = jTxtRegMobile.getText();
String TxtEmail = jTxtRegEmail.getText();
String RtbAddress = jRtbRegAddress.getText();
String TxtUname = jTxtRegUname.getText();
String PdPsd = new String(jPdRegPsd.getPassword());
try
{
pst=conn.prepareStatement("update REGISTRATION set REGSLNO='"+TxtSlno+"',REGNAME=
'"+TxtName+"',REGFNAME='"+TxtFname+"',REGDOB='"+pp+"',REGGENDER='"+gender+"',
REGMATRIC= '"+ChkMatric+"',REGINTER='"+ChkInter+"',REGGRAD='"+ChkGrad+"',
REGPG='"+ChkPg+"',REGMOBILE='"+TxtMobile+"',REGEMAIL='"+TxtEmail+"',
REGSTATE='"+CmbState1+"',REGADDRESS='"+RtbAddress+"', REGPSD='"+PdPsd+"'
where REGUNAME='"+TxtUname+"'");
pst.executeUpdate();
showMessageDialog(null, "Data Update Successfully...");
}
catch(Exception e)
{
System.out.println(e);
}
}
0 Comments