Coding of Hospital Management Patient Bill Generating System
Coding of Hospital Management Patient Bill Generating System
Frontpage.java
import java.sql.*;
import javax.swing.JOptionPane;
private void btnsaveActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try
{
Class.forName("java.sql.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/hospitalrec","root","1")
;
Statement stmt=con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Saved Successfully");
stmt.close();
con.close();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"Error in Connectivity");
}
}
new menuscreen().setVisible(true);
}
import java.sql.*;
import javax.swing.JOptionPane;
private void btnnew1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try
{ Class.forName("java.sql.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/hospitalrec","root","1");
Statement stmt =con.createStatement();
txtpname.setText(" "+cname1);
txtaddress.setText(" "+addr1);
txtphone.setText(" "+phone1);
txtdisease.setText(" "+disease1);
txtdname.setText(" "+dname1);
txtndays.setText(" "+days1);
txtcfees.setText(" "+cfees1);
txtmeal.setText(" "+meal1);
txtroom.setText(" "+room1);
txttype.setText(" "+type1);
txttotal.setText(" "+total1);
}
else
{
txtpno.setText(" ");
txtpname.setText(" ");
txtaddress.setText(" ");
txtphone.setText(" ");
txtdisease.setText(" ");
txtdname.setText(" ");
txtndays.setText(" ");
txtcfees.setText(" ");
txtmeal.setText(" ");
txtroom.setText(" ");
txttype.setText(" ");
txttotal.setText(" ");
JOptionPane.showMessageDialog(null, "No such record found");
}
} //end of try
catch(Exception e)
{ JOptionPane.showMessageDialog(null, "Error in connectivity");
}
}
catch(Exception e)
{ JOptionPane.showMessageDialog(null, "Error in updation");
}
}//end of if.
}
new menuscreen().setVisible(true);
}
Deletepatient.java
import java.sql.*;
import javax.swing.JOptionPane;
private void btnnew1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try {
Class.forName("java.sql.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/hospitalrec","root","1");
Statement stmt =con.createStatement();
txtpname.setText(" "+cname1);
txtaddress.setText(" "+addr1);
txtphone.setText(" "+phone1);
txtdisease.setText(" "+disease1);
txtdname.setText(" "+dname1);
txtndays.setText(" "+days1);
txtcfees.setText(" "+cfees1);
txtmeal.setText(" "+meal1);
txtroom.setText(" "+room1);
txttype.setText(" "+type1);
txttotal.setText(" "+total1);
} else {
txtpno.setText(" ");
txtpname.setText(" ");
txtaddress.setText(" ");
txtphone.setText(" ");
txtdisease.setText(" ");
txtdname.setText(" ");
txtndays.setText(" ");
txtcfees.setText(" ");
txtmeal.setText(" ");
txtroom.setText(" ");
txttype.setText(" ");
txttotal.setText(" ");
JOptionPane.showMessageDialog(null, "No such record found");
}
} //end of try
catch(Exception e) {
JOptionPane.showMessageDialog(null, "Error in connectivity");
}
}
import javax.swing.JOptionPane;
}
}