You are on page 1of 50

Event on jButton5;

jTextField9.setText(null);
jTextField10.setText(null);

Event on jMenuItem4;
six.setVisible(true);

Event on jRadioButton1;
if(jRadioButton1.isSelected()==true)
jTextField5.setText("M");

Event on jRadioButton2;
if(jRadioButton2.isSelected()==true)
jTextField5.setText("F");

Event on jButton6;
String name,fname,mname,address,sex,age,emailid,phoneno;
name = jTextField11.getText();
fname = jTextField12.getText();
mname = jTextField13.getText();
address=jTextArea2.getText();
sex = jTextField14.getText();
age = jTextField15.getText();
emailid = jTextField16.getText();

phoneno= jTextField17.getText();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
stmt = con.createStatement();
String query = "INSERT INTO profile
VALUES('"+name+"','"+fname+"','"+mname+"','"+address+"','"+sex+"','"+age+
"','"+emailid+"','"+phoneno+"');";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Record Has Been Inserted");
stmt.close();
con.close();

}
catch(Exception e)
{

JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is


the error?"
}

Event on sixWindow;
jTextField14.setEditable(false);
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
stmt = con.createStatement();
String query = "CREATE TABLE IF NOT EXISTS profile(name
varchar(35) not null,fname varchar(35),mname varchar(35),address
varchar(65),sex varchar(4),age integer(4),emailid varchar(45), mobileno
integer(25));";
stmt.execute(query);
stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jRadioButton3;
if(jRadioButton3.isSelected()==true)
jTextField14.setText("M");

Event on jRadioButton4;
if(jRadioButton4.isSelected()==true)
jTextField14.setText("F");

Event on jButton7;
jTextField11.setText(null);
jTextField12.setText(null);
jTextField13.setText(null);
jTextField14.setText(null);
jTextField15.setText(null);
jTextArea2.setText(null);
jTextField16.setText(null);
jTextField17.setText(null);
jRadioButton3.setSelected(false);
jRadioButton4.setSelected(false);

Event on jMenuItem5;
seven.setVisible(true);

Event on jButton8;
DefaultTableModel model=(DefaultTableModel)jTable1.getModel();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
ResultSet rs = null;
stmt = con.createStatement();
String query = "SELECT * FROM enteries ORDER BY name ASC;";
rs = stmt.executeQuery(query);
while(rs.next())
{

String d1= rs.getString("name");


String d2= rs.getString("phoneno");
String d3= rs.getString("age");
String d4= rs.getString("sex");
String d5= rs.getString("emailid");
String d6= rs.getString("address");
model.addRow(new Object[] {d1,d2,d3,d4,d5,d6});
}
JOptionPane.showMessageDialog(null,"Query Had Been Successfully
Runned");
stmt.close();
rs.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jButton9;
DefaultTableModel model=(DefaultTableModel)jTable2.getModel();
try
{
//Loading Driver

Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
ResultSet rs = null;
stmt = con.createStatement();
String query = "SELECT * FROM mobile ORDER BY name ASC;";
rs=stmt.executeQuery(query);
while(rs.next())
{
String d1= rs.getString("name");
String d2= rs.getString("phoneno");
model.addRow(new Object[] {d1,d2});
}
JOptionPane.showMessageDialog(null,"Query Had Been Successfully
Runned");
stmt.close();
rs.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jMenuItem7;
eight.setVisible(true);

Event on jMenuItem8
nine.setVisible(true);

Event on jButton10;
DefaultTableModel model=(DefaultTableModel)jTable3.getModel();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
ResultSet rs = null;

stmt = con.createStatement();
String query = "SELECT * FROM eid ORDER BY name ASC;";
rs=stmt.executeQuery(query);
while(rs.next())
{
String d1= rs.getString("name");
String d2= rs.getString("emailid");
model.addRow(new Object[] {d1,d2});
}
JOptionPane.showMessageDialog(null,"Query Had Been Successfully
Runned");
stmt.close();
rs.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on MenuItem9;
ten.setVisible(true);

Event on jButton11;
DefaultTableModel model=(DefaultTableModel)jTable4.getModel();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
ResultSet rs = null;
stmt = con.createStatement();
String query = "SELECT * FROM profile ORDER BY name ASC;";
rs = stmt.executeQuery(query);
while(rs.next())
{
String d1= rs.getString("name");

String d2= rs.getString("fname");


String d3= rs.getString("mname");
String d4= rs.getString("address");
String d5= rs.getString("sex");
String d6= rs.getString("age");
String d7= rs.getString("emailid");
String d8= rs.getString("mobileno");
model.addRow(new Object[] {d1,d2,d3,d4,d5,d6,d7,d8});
}
JOptionPane.showMessageDialog(null,"Query Had Been Successfully
Runned");
stmt.close();
rs.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jMenuItem6;
eleven.setVisible(true);

Event on jButton12;
String name;
name=jTextField18.getText();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
stmt = con.createStatement();
String query = "DELETE FROM enteries WHERE name='"+name+"';";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Record Has Been Deleted");
stmt.close();
con.close();

}
catch(Exception e)

{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jMenuItem10;
twelve.setVisible(true);

Event on jButton13;
String name;
name=jTextField19.getText();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
stmt = con.createStatement();
String query = "DELETE FROM mobile WHERE name='"+name+"';";
stmt.executeUpdate(query);

JOptionPane.showMessageDialog(null,"Record Has Been Deleted");


stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jMenuItem11;
thirteen.setVisible(true);

Event on jButton14;
String name;
name=jTextField20.getText();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);

Statement stmt = null;


stmt = con.createStatement();
String query = "DELETE FROM eid WHERE name='"+name+"';";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Record Has Been Deleted");
stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jMenuItem12;
fourteen.setVisible(true);

Event on jButton15;
String name;
name=jTextField21.getText();

try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
stmt = con.createStatement();
String query = "DELETE FROM profile WHERE name='"+name+"';";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Record Has Been Deleted");
stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jMenuItem14;
fifteen.setVisible(true);

Event on jMenuItem15;
sixteen.setVisible(true);

Event on jMenuItem16;
seventeen.setVisible(true);

Event on jButton16;
String no,newno;
no=jTextField22.getText();
newno=jTextField23.getText();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
stmt = con.createStatement();

String query = "UPDATE enteries SET phoneno='"+newno+"' WHERE


phoneno='"+no+"';";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Record Has Been Updated");
stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jButton17;
int age,newage;
age=Integer.parseInt(jTextField24.getText());
newage=Integer.parseInt(jTextField25.getText());
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database

Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
stmt = con.createStatement();
String query = "UPDATE enteries SET age='"+newage+"' WHERE
age='"+age+"';";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Record Has Been Updated");
stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jMenuItem13;
eighteen.setVisible(true);

Event on jButton18;
String address,newaddress;
address=jTextArea3.getText();
newaddress=jTextArea4.getText();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
stmt = con.createStatement();
String query = "UPDATE enteries SET address='"+newaddress+"'
WHERE address='"+address+"';";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Record Has Been Updated");
stmt.close();
con.close();

catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jButton19;
String emailid,newemailid;
emailid=jTextField26.getText();
newemailid=jTextField27.getText();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
stmt = con.createStatement();
String query = "UPDATE enteries SET emailid='"+newemailid+"' WHERE
emailid='"+emailid+"';";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Record Has Been Updated");

stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jMenuItem17;
ninteen.setVisible(true);

Event on jMenuItem18;
twenty.setVisible(true);

Event on jButton20;
int no,newno;
no=Integer.parseInt(jTextField28.getText());
newno=Integer.parseInt(jTextField29.getText());
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database

Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
stmt = con.createStatement();
String query = "UPDATE mobile SET phoneno='"+newno+"' WHERE
phoneno='"+no+"';";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Record Has Been Updated");
stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jButton21;
String eid,neweid;
eid=jTextField30.getText();

neweid=jTextField31.getText();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
stmt = con.createStatement();
String query = "UPDATE eid SET emailid='"+neweid+"' WHERE
emailid='"+eid+"';";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Record Has Been Updated");
stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"

Event on jMenuItem19;
twentyone.setVisible(true);

Event on jMenuItem20;
twentytwo.setVisible(true);

Event on jMenuItem21;
twentythree.setVisible(true);

Event on jMenuItem22;
twentyfour.setVisible(true);

Event on jButton22;
String no,newno;
no=jTextField32.getText();
newno=jTextField33.getText();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);

Statement stmt = null;


stmt = con.createStatement();
String query = "UPDATE profile SET mobileno='"+newno+"' WHERE
mobileno='"+no+"';";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Record Has Been Updated");
stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jButton23;
String age,newage;
age=jTextField34.getText();
newage=jTextField35.getText();
try
{

//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
stmt = con.createStatement();
String query = "UPDATE profile SET age='"+newage+"' WHERE
age='"+age+"';";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Record Has Been Updated");
stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jButton24;
String address,newaddress;
address=jTextArea5.getText();
newaddress=jTextArea6.getText();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
stmt = con.createStatement();
String query = "UPDATE profile SET address='"+newaddress+"' WHERE
address='"+address+"';";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Record Has Been Updated");
stmt.close();
con.close();

catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jButton25;
String eid,neweid;
eid=jTextField36.getText();
neweid=jTextField37.getText();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
stmt = con.createStatement();
String query = "UPDATE profile SET emailid='"+neweid+"' WHERE
emailid='"+eid+"';";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Record Has Been Updated");

stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jButton26;
twentyfive.setVisible(true);

Event on jButton27;
twentysix.setVisible(true);

Event on twentysixWindow;
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);

Statement stmt = null;


stmt = con.createStatement();
String query = "CREATE TABLE IF NOT EXISTS diaryentery1(dateent
Date,subject varchar(55) not null,entid integer(4) Primary Key, entry
varchar(999));";
stmt.execute(query);
stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jButton29;
String subject,entry;
String date;
date=jTextField38.getText();
subject=jTextField39.getText();
int entid=Integer.parseInt(jTextField62.getText());
entry=jTextArea7.getText();

try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
stmt = con.createStatement();
String query = "INSERT INTO diaryentery1
VALUES('"+date+"','"+subject+"','"+entid+"','"+entry+"');";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Record Has Been Inserted");
stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"

Event on jButton30;
twentyseven.setVisible(true);

Event on jButton31;
String eno;
eno=jTextField63.getText();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
ResultSet rs = null;
stmt = con.createStatement();
String query = "SELECT * FROM diaryentery1 WHERE entid='"+eno+"';";
rs=stmt.executeQuery(query);
while(rs.next())
{

String d1= rs.getString("dateent");


String d2= rs.getString("subject");
String d3= rs.getString("entry");
jTextField40.setText(d1);
jTextField41.setText(d2);
jTextArea8.setText(d3);
jTextField40.setEditable(false);
jTextField41.setEditable(false);
jTextArea8.setEditable(false);
}
JOptionPane.showMessageDialog(null,"Query Had Been Successfully
Runned");
stmt.close();
rs.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jButton32;
String enano=jTextField42.getText();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
ResultSet rs = null;
stmt = con.createStatement();
String query = "SELECT * FROM enteries WHERE name='"+enano+"' OR
phoneno='"+enano+"';";
rs=stmt.executeQuery(query);
while(rs.next())
{
String d1= rs.getString("name");
String d2= rs.getString("phoneno");
String d3= rs.getString("age");
String d4= rs.getString("sex");

String d5= rs.getString("emailid");


String d6= rs.getString("address");
jTextField43.setText(d1);
jTextField44.setText(d2);
jTextField45.setText(d3);
jTextField46.setText(d4);
jTextField47.setText(d5);
jTextArea9.setText(d6);
jTextField43.setEditable(false);
jTextField44.setEditable(false);
jTextField45.setEditable(false);
jTextField46.setEditable(false);
jTextField47.setEditable(false);
jTextArea9.setEditable(false);
}
JOptionPane.showMessageDialog(null,"Query Had Been Successfully
Runned");
stmt.close();
rs.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"

Event on jMenuItem23
twentyeight.setVisible(true);

Event on jMenuItem24;
twentynine.setVisible(true);

Event on jButton33;
String enano=jTextField48.getText();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
ResultSet rs = null;
stmt = con.createStatement();

String query = "SELECT * FROM mobile WHERE name='"+enano+"' OR


phoneno='"+enano+"';";
rs=stmt.executeQuery(query);
while(rs.next())
{
String d1= rs.getString("name");
String d2= rs.getString("phoneno");

jTextField49.setText(d1);
jTextField50.setText(d2);

jTextField49.setEditable(false);
jTextField50.setEditable(false);
}
JOptionPane.showMessageDialog(null,"Query Had Been Successfully
Runned");
stmt.close();
rs.close();
con.close();

catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}
private void jButton34ActionPerformed(java.awt.event.ActionEvent evt) {
jTextField48.setText(null);
jTextField49.setText(null);
jTextField50.setText(null);

Event on jButton35;
jTextField42.setText(null);
jTextField43.setText(null);
jTextField44.setText(null);
jTextField45.setText(null);
jTextField46.setText(null);
jTextField49.setText(null);
jTextArea9.setText(null);
private void jMenuItem25
thirty.setVisible(true);

Event on jButton37;
jTextField51.setText(null);
jTextField52.setText(null);
jTextField53.setText(null);
Event on jButton36;

String enano=jTextField51.getText();
try
{
//Loading Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
ResultSet rs = null;
stmt = con.createStatement();
String query = "SELECT * FROM eid WHERE name='"+enano+"' OR
emailid='"+enano+"';";
rs=stmt.executeQuery(query);
while(rs.next())
{
String d1= rs.getString("name");
String d2= rs.getString("emailid");

jTextField52.setText(d1);
jTextField53.setText(d2);

jTextField52.setEditable(false);
jTextField53.setEditable(false);
}
JOptionPane.showMessageDialog(null,"Query Had Been Successfully
Runned");
stmt.close();
rs.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jMenuItem26
thirtyone.setVisible(true);

Event on jButton39;
jTextField54.setText(null);

jTextField55.setText(null);
jTextField56.setText(null);
jTextField57.setText(null);
jTextField58.setText(null);
jTextField59.setText(null);
jTextField60.setText(null);
jTextField61.setText(null);
jTextArea10.setText(null);
}

Event on jButton38;
String enano=jTextField54.getText();
try
{
//Loding Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
ResultSet rs = null;
stmt = con.createStatement();
String query = "SELECT * FROM profile WHERE name='"+enano+"' OR
mobileno='"+enano+"';";

rs=stmt.executeQuery(query);
while(rs.next())
{
String d1= rs.getString("name");
String d2= rs.getString("fname");
String d3= rs.getString("mname");
String d4= rs.getString("address");
String d5= rs.getString("sex");
String d6= rs.getString("age");
String d7= rs.getString("emailid");
String d8= rs.getString("mobileno");
jTextField55.setText(d1);
jTextField56.setText(d2);
jTextField57.setText(d3);
jTextArea10.setText(d4);
jTextField58.setText(d5);
jTextField59.setText(d6);
jTextField60.setText(d7);
jTextField61.setText(d8);
jTextField55.setEditable(false);
jTextField56.setEditable(false);
jTextField57.setEditable(false);
jTextField58.setEditable(false);
jTextField59.setEditable(false);
jTextField60.setEditable(false);
jTextField61.setEditable(false);

jTextArea10.setEditable(false);
}
JOptionPane.showMessageDialog(null,"Query Had Been Successfully
Runned");
stmt.close();
rs.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jButton40;
thirtytwo.setVisible(true);

Event on jButton41;
DefaultTableModel model=(DefaultTableModel)jTable5.getModel();
try
{
//Loding Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database

Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;
ResultSet rs = null;
stmt = con.createStatement();
String query = "SELECT * FROM diaryentery1 ORDER BY dateent ASC;";
rs = stmt.executeQuery(query);
while(rs.next())
{
String d1= rs.getString("dateent");
String d2= rs.getString("subject");
String d3= rs.getString("entid");

model.addRow(new Object[] {d1,d2,d3});


}
JOptionPane.showMessageDialog(null,"Query Had Been Successfully
Runned");
stmt.close();
rs.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

Event on jMenuItem27;
thirtythree.setVisible(true);

Event on jMenuItem28;
thirtyfour.setVisible(true);

Event on jButton42;
String opass, npass, cpass;
int len1=0, len2=0, len3=0, flag2=0;
opass = new String(jPasswordField2.getPassword());
len1 = opass.length();
if(len1<=0)
{
JOptionPane.showMessageDialog(null,"Enter Password");
jPasswordField2.requestFocus();
}
else
{

try{
//Loding Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection con =
(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidiary"
,"root",mysqlpass);
Statement stmt = null;
ResultSet rs = null;
stmt = con.createStatement();
String query1 = "SELECT * FROM signin WHERE pass
='"+(opass)+"';";
rs = stmt.executeQuery(query1);
while(rs.next())
{
flag2=1;
}
if(flag2==1)
{
npass = new String(jPasswordField3.getPassword());
len2 = npass.length();
if(len2<=0)
{
JOptionPane.showMessageDialog(null,"Enter New Password");
jPasswordField3.requestFocus();
}
else

{
cpass = new String(jPasswordField4.getPassword());
len3 = cpass.length();
if(len3<=0)
{
JOptionPane.showMessageDialog(null,"Enter confirm Password");
jPasswordField4.requestFocus();
}
else if (npass.equals(cpass))
{
String query = "UPDATE signin SET pass='"+(cpass)+"' WHERE pass
='"+(opass)+"' ;";
stmt.executeUpdate(query);

JOptionPane.showMessageDialog(null,"Password has been change


successfully");
}
else
{
JOptionPane.showMessageDialog(null, "New Password and Confirm
Password must be same");
}
}

else
JOptionPane.showMessageDialog(null,"Enter password is wrong");
stmt.close();
con.close();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"Error :" +e);//It Show "What
is the error?"
}
}

Event on jButton43;
String username=jTextField64.getText();
try
{
//Loding Driver
Class.forName("com.mysql.jdbc.Connection");
//Connecting to the Database
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/digidi
ary","root", mysqlpass);
Statement stmt = null;

stmt = con.createStatement();
String query = "UPDATE signin SET uname='"+username+"';";
stmt.execute(query);
JOptionPane.showMessageDialog(null,"Enter password is wrong");
stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error:"+e);//It Show "What is
the error?"
}

You might also like