Student Management System: Java Mini Project Report

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 44

STUDENT MANAGEMENT SYSTEM

JAVA MINI PROJECT REPORT

Submitted by

A.NAGARAJAN (9916008033)
S.VIGNESH (9916008056)
V.VIKRAM KISHORE (9916008058)
M.LOGESHWARAN (9916008059)

in partial fulfilment for the award of the degree

of

BACHELOR OF TECHNOLOGY

In

INFORMATION TECHNOLOGY

KALASALINGAM ACADEMY OF RESEARCH AND EDUCATION

(DEEMED TO BE UNIVERSITY)

KRISHNANKOIL 626 126

Academic Year 2018-2019

1
KALASALINGAM ACADEMY OF RESEARCH AND EDUCATION

(DEEMED TO BE UNIVERSITY)

KRISHNANKOIL 626 126

BONAFIDE CERTIFICATE

Certified that this project report “STUDENT MANAGEMENT SYSTEM” is the bonafide work of
“A.NAGARAJAN (9916008033), S.VIGNESH (9916008056), V.VIKRAM KISHORE
(9916008058), M.LOGESHWARAN (9916008059)” who carried out the project work under my
supervision.

SUPERVISOR HEAD OF THE DEPARTMENT


Dr. G. PRABU KANNA Dr.M. VENKATESULU
ASSISTANT PROFESSOR SENIOR PROFESSOR
INFORMATION TECHNOLOGY INFORMATION TECHNOLOGY

Submitted for the Project Viva-voce examination held on.......................................

Internal Examiner External Examiner

2
ACKNOWLEDGEMET

“Gratitude is the fairest blossom which springs from the soul”

In our endeavour to complete a comprehensive work on our dissertation community service


project would like to thank many people as regardless of several constraints this dissertation
would never have been written without the patience, encouragement, help and advice offered
by them.
We convey our sincere and heartfelt gratitude to our chancellor “ Ilayavallal Dr. Sridharan ”
for giving us the opportunity to involve in project.
We express our profound thanks to our vice president “Dr. S. Shasi Anand” for all his valuable
advice to make our project a great success.
We would like to convey our gratitude and thanks to our vice-chancellor “Dr. R. Nagaraj” for
his motivation and providing us the moral support during this work.
We are extremely thankful and indebted to Dr.V.Vasudevan, Registrar of Kalasalingam
Academy of Research and Education who has given us the facilities to do our project
successfully.
We would like to thank “Dr.M.Venkatesulu”, Head of Department, Department Information
Technology for his keen interest he has shown on us throughout our under-graduate course in
Kalasalingam Academy of Research and Education.
We are much obliged to Dr. G.PRABU KANNA, Assistant Professor, who is Our project
guide, for extending his support and encouraging by giving constructive criticism during the
entire project period.
We also express my gratitude to all the staff members, Information Technology, Kalasalingam
Academy of Research and Education for their constant help and encouragement, which led to
the accomplishment of this project.
Finally, we thank all, our parents, teaching staff, non-teaching staff and our friends for their
moral support.

3
ABSTRACT

Students form a main part of any institution that concerns with. But the institutions find it
difficult to keep details of so many students of the organization just in one stretch. It will
involve a lot of pen paper work. Sometimes there will be some huge heap of files bundled up
and kept together in some corner of the office. If you want any information regarding the
particular student then it can be obtained by just entering the roll number or the name of the
student to be searched. This student management system will make the work of storing the data
in an organized way.
The student management system application will help in managing the student’s reports, results
and exams will become easier with one such system. It will also help in saving time and effort.
The user interface must be user friendly and easy to understand. The information of the
particular student will be obtained in just one mouse click.
Some of the features that it can include are as follows:

Student database management: The details of the students of the organizations can be stored in
the database with the use this application.
Results: The results of the students can also be accessed and stored through this application.
Security: The data that will be disclosed will be more secure since there will be no access to
the unknown users.
Performance: The performance of the students might be in curriculum as well as co-curriculum
can also be stored through the use of this application.
One-click access: You will obtain the details of the students by entering his/her name or the
roll number just in one click.
User interface: The user interface must be simple and easy to understand.
Personal details: All the personal details of the students can be obtained in just one mouse click.

4
TABLE OF CONTENT

S.NO CONTENT PAGE


1 INTRODUCTION 6
2 EXISTING SYSTEM 7
3 PROPOSED SYSTEM 8
4 FEASIBILITY ANALYSIS 8
4.1 TECHNICAL FEASIBILITY 8
4.2 ECONOMICAL FEASIBILITY 9
5 CONFIGURATIONS 9
5.1 HARDWARE CONFIGURATION 9
5.2 SOFTWARE CONFIGURATION 10
6 DATA TYPE 10
7 SYSTEM IMPLEMENTATION 11
7.1 END USER TRAINING 11
7.2 END USER EDUCATION 11
7.3 TRAINING OF APPLICATION 12
SOFTWARE
7.4 POST IMPLEMENTATION VIEW 12
8 SOFTWARE TESTING 12
8.1 WHITE BOX TESTING 13
8.2 BLACK BOX TESTING 13
9 CODING 14
10 OUTPUT 39
11 CONCLUSION 44
12 REFERENCE 44

5
1. INTRODUCTION

Student Management System is software which is helpful for students as well as the
school authorities. In the current system all the activities are done manually. It is very time
consuming and costly. Our Student Management System deals with the various activities
related to the students.
There are mainly 3 modules in this software
• User module

• Student Module

• Mark management

In the Software we can register as a user and user has of two types, student and
administrator. Administrator has the power to add new user and can edit and delete a user. A
student can register as user and can add edit and delete his profile. The administrator can add
edit and delete marks for the student. All the users can see the marks.

6
2. EXISTING SYSTEM

System Analysis is a detailed study of the various operations performed by a system


and their relationships within and outside of the system. Here the key question is- what all
problems exist in the present system? What must be done to solve the problem? Analysis begins
when a user or manager begins a study of the program using existing system.
During analysis, data collected on the various files, decision points and transactions handled
by the present system. The commonly used tools in the system are Data Flow Diagram,
interviews, etc. Training, experience and common sense are required for collection of relevant
information needed to develop the system. The success of the system depends largely on how
clearly the problem is defined, thoroughly investigated and properly carried out through the
choice of solution. A good analysis model should provide not only the mechanisms of problem
understanding but also the frame work of the solution. Thus it should be studied thoroughly
by collecting data about the system. Then the proposed system should be analysed thoroughly
in accordance with the needs.
System analysis can be categorized into four parts.
➢ System planning and initial investigation
➢ Information Gathering
➢ Applying analysis tools for structured analysis
➢ Feasibility study
➢ Cost/ Benefit analysis.

In the current system we need to keep a number of records related to the student and
want to enter the details of the student and the marks manually. In this system only the teacher
or the school authority views the mark of the student and they want to enter the details of the
student. This is time consuming and has much cost.

7
3. PROPOSED SYSTEM

In our proposed system we have the provision for adding the details of the students by
themselves. So the overhead of the school authorities and the teachers is become less. Another
advantage of the system is that it is very easy to edit the details of the student and delete a
student when it found unnecessary. The marks of the student are added in the database and so
students can also view the marks whenever they want.
Our proposed system has several advantages

➢ User friendly interface


➢ Fast access to database
➢ Less error
➢ More Storage Capacity
➢ Search facility
➢ Look and Feel Environment
➢ Quick transaction

All the manual difficulties in managing the student details in a school or college have
been rectified by implementing computerization.

4. FEASIBILITY ANALYSIS

Whatever we think need not be feasible. It is wise to think about the feasibility of any
problem we undertake. Feasibility is the study of impact, which happens in the organization by
the development of a system. The impact can be either positive or negative. When the positives
nominate the negatives, then the system is considered feasible. Here the feasibility study can
be performed in two ways such as technical feasibility and Economical Feasibility.

8
4.1 TECHNICAL FEASIBILITY

We can strongly says that it is technically feasible, since there will not be much
difficulty in getting required resources for the development and maintaining the system as well.
All the resources needed for the development of the software as well as the maintenance of the
same is available in the organization here we are utilizing the resources which are available
already.

4.2 ECONOMICAL FEASIBILITY

Development of this application is highly economically feasible. The organization


needed not spend much money for the development of the system already available. The only
thing is to be done is making an environment for the development with an effective supervision.
If we are doing so, we can attain the maximum usability of the corresponding resources. Even
after the development, the organization will not be in condition to invest more in the
organization. There fore, the system is economically feasible.

5. CONFIGURATIONS

5.1 HARDWARE CONFIGURATION

• Processor : Pentium III 630MHz


• RAM : 128 MB
• Hard Disk : 20 GB
• Monitor : 15” Colour monitor
• Key Board : 122 Keys

9
5.2 SOFTWARE CONFIGURATION

• Operating System : Windows NT, 98, XP, 7, 8, 8.1, 10


• Language : Java 2 Runtime Environment
• Database : MS Access2007.

6. DATA TYPE

Field Name Data Type


RollNo Number
SName Text(50)
Phno Text(15)
Sex Text(10)
FName Text(50)
Occupation Text(50)
MName Text(50)
DOB Date/Time
Age Number
Caste Text(25)
Religion Text(30)
Hname Text(50)
City Text(50)
District Text(50)
State Text(50)
Pin Text(10)
Year Number
Qualification Text(25)

10
7. SYSTEM IMPLEMENTATION

Implementation is the stage in the project where the theoretical design is turned into a
working system. The implementation phase constructs, installs and operates the new system.
The most crucial stage in achieving a new successful system is that it will work efficiently and
effectively.
There are several activities involved while implementing a new project.
They are
➢ End user training
➢ End user Education
➢ Training on the application software
➢ System Design
➢ Parallel Run and To New System
➢ Post implementation Review

7.1 END USER TRAINING

The successful implementation of the new system will purely upon the involvement of
the officers working in that department. The officers will be imparted the necessary training on
the new technology.

7.2 END USER EDUCATION


The Education of the end user start after the implementation and testing is over. When
the system is found to be more difficult to under stand and complex, more effort is put to
educate the end used to make them aware of the system, giving them lectures about the new
system and providing them necessary documents and materials about how the system can do
this.

11
7.3 TRAINING OF APPLICATION SOFTWARE
After providing the necessary basic training on the computer awareness, the users will
have to be trained upon the new system such as the screen flows and screen design type of help
on the screen, type of errors while entering the data, the corresponding validation check at each
entry and the way to correct the data entered. It should then cover information needed by the
specific user or group to use the system.

7.4 POST IMPLEMENTATION VIEW


The Department is planning a method to know the states of the past implementation
process. For that regular meeting will be arranged by the concerned officers about the
implementation problem and success.

8. SOFTWARE TESTING

Is the menu bar displayed in the appropriate contested some system related features
included either in menus or tools? Do pull –Down menu operation and Tool-bars work
properly? Are all menu function and pull down sub function properly listed? ; Is it possible to
invoke each menu function using a logical assumptions that if all parts of the system are correct,
the goal will be successfully achieved? In adequate testing or non-testing will leads to errors
that may appear few months later.
This create two problem
➢ Time delay between the cause and appearance of the problem.
➢ The effect of the system errors on files and records within the system.
The purpose of the system testing is to consider all the likely variations to which it will
be suggested and push the systems to limits.
The testing process focuses on the logical intervals of the software ensuring that all
statements have been tested and on functional interval is conducting tests to uncover errors and
ensure that defined input will produce actual results that agree with the required results.
Program level testing, modules level testing integrated and carried out.
There are two major type of testing they are
➢ White Box Testing.
➢ Black Box Testing.

12
8.1 WHITE BOX TESTING
White box some times called “Glass box testing” is a test case design uses the control
structure of the procedural design to drive test case.
Using white box testing methods, the following tests where made on the system
a) All independent paths within a module have been exercised once. In our system, ensuring
that case was selected and executed checked all case structures. The bugs that were prevailing
in some part of the code where fixed
b) All logical decisions were checked for the truth and falsity of the values.

8.2 BLACK BOX TESTING


Black box testing focuses on the functional requirements of the software. This is black
box testing enables the software engineering to derive a set of input conditions that will fully
exercise all functional requirements for a program. Black box testing is not an alternative to
white box testing rather it is complementary approach that is likely to uncover a different class
of errors that white box methods like.,
• Interface errors
• Performance in data structure
• Performance errors
• Initializing and termination errors

13
9. CODING
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

public class Login extends JFrame implements ActionListener {

Container c = getContentPane();
private JButton btnLogin, btnCancel;
private JLabel lblUName, lblPasswd;
private JTextField txtUName;
private JPasswordField txtPasswd;

public Login() {
super("Login ...");
this.setSize(350, 200);
this.setLayout(null);
this.setResizable(false);
this.setLocation((Settings.getScreenSize().width / 2) - 175, (Settings.getScreenSize().height /
2) - 150);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);

14
lblUName = new JLabel("Username");
lblPasswd = new JLabel("Password");
txtUName = new JTextField();
txtPasswd = new JPasswordField();
btnLogin = new JButton("Login", new
ImageIcon(ClassLoader.getSystemResource("Images/login.png")));
btnCancel = new JButton("Cancel",new
ImageIcon(ClassLoader.getSystemResource("Images/cancel.png")));
lblUName.setBounds(50, 40, 140, 25);
txtUName.setBounds(150, 40, 130, 25);
lblPasswd.setBounds(50, 80, 140, 25);
txtPasswd.setBounds(150, 80, 130, 25);
btnLogin.setBounds(50, 120, 100, 25);
btnCancel.setBounds(180, 120, 100, 25);
btnLogin.addActionListener(this);
btnCancel.addActionListener(this);
this.add(lblUName);
this.add(lblPasswd);
this.add(txtUName);
this.add(txtPasswd);
this.add(btnLogin);
this.add(btnCancel);
}//constructor closed
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnLogin) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:student");
try {
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("SELECT * FROM UAD WHERE Username='" +
txtUName.getText() +
"' and Password='" + txtPasswd.getText() + "'");
if (rs.next()) {

15
if (rs.getString(3).equals("Student")) {
userMDI frm = new userMDI();
frm.setVisible(true);
} else {
new frmAdminMDI().setVisible(true);
}
this.dispose();
}else{
JOptionPane.showMessageDialog(null,"Invalid username or
password","Invalid",JOptionPane.ERROR_MESSAGE);
}
con.close();

} catch (Exception ex) {


JOptionPane.showMessageDialog(null, "Invalid username or password", "Invalid",
JOptionPane.ERROR_MESSAGE);
txtUName.setText("");
txtPasswd.setText("");
}//inner try catch closed
} catch (Exception x) {
JOptionPane.showMessageDialog(null, "Unable to connect to the database", "Connection
error", JOptionPane.ERROR_MESSAGE);
}//outer try catch closed
}//if closed

if (e.getSource() == btnCancel) {
System.exit(0);
}//if closed
}//actionPerformed() closed
public static void main(String args[]) {
new Login().setVisible(true);
}
}//class closed
import java.awt.event.ActionEvent;

16
import java.awt.event.ActionListener;
import java.sql.Statement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextField;

public class NewUserReg extends JInternalFrame implements ActionListener {

private JRadioButton rdoStudent;


private JRadioButton rdoAdmin;
private JLabel lblUsername;
private JLabel lblPassword;
private JLabel lblCPassword;
private JTextField txtUsername;
private JPasswordField txtPassword;
private JPasswordField txtCPassword;
private JButton btnSave;
private ButtonGroup group;

public NewUserReg() {
super("User registration", false, true, false, true);
this.setLayout(null);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.setLocation(300, 175);
this.setSize(350, 300);

17
group = new ButtonGroup();
rdoStudent = new JRadioButton("Student");
rdoAdmin = new JRadioButton("Administrator");
lblUsername = new JLabel("User name");
lblPassword = new JLabel("Enter the password");
lblCPassword = new JLabel("Confirm password");
txtUsername = new JTextField();
txtPassword = new JPasswordField();
txtCPassword = new JPasswordField();
btnSave = new JButton("Save", new
ImageIcon(ClassLoader.getSystemResource("Images/save.png")));
lblUsername.setBounds(30, 30, 100, 30);
lblPassword.setBounds(30, 80, 150, 30);
lblCPassword.setBounds(30, 130, 150, 30);
txtUsername.setBounds(150, 30, 150, 25);
txtPassword.setBounds(150, 80, 150, 25);
txtCPassword.setBounds(150, 130, 150, 25);
rdoStudent.setBounds(60, 170, 100, 30);
rdoAdmin.setBounds(170, 170, 150, 30);
btnSave.setBounds(120, 210, 100, 25);
group.add(rdoAdmin);
group.add(rdoStudent);
add(lblUsername);
add(lblPassword);
add(lblCPassword);
add(txtUsername);
add(txtPassword);
add(txtCPassword);
add(rdoStudent);
add(rdoAdmin);
add(btnSave);
btnSave.addActionListener(this);
rdoStudent.setSelected(true);
}//constructor closed

18
public void actionPerformed(ActionEvent e) {
String Type;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:student");
Statement st = con.createStatement();
try {
if (e.getSource() == btnSave) {
String Username = txtUsername.getText();
String Password = txtPassword.getText();
String CPassword = txtCPassword.getText();
if (!CPassword.equals(Password)) {
JOptionPane.showMessageDialog(null, "Password and Confirm Password fields does not
match", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
String str = "insert into UAD(Username,Password,Type) values(?,?,?)";
PreparedStatement ps = con.prepareStatement(str);
if (rdoStudent.isSelected()) {
Type = "Student";
} else {
Type = "Admin";
}
ps.setString(1, Username);
ps.setString(2, Password);
ps.setString(3, Type);
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "Database successfully updated", "Success",
JOptionPane.INFORMATION_MESSAGE);
txtUsername.setText("");
txtPassword.setText("");
txtCPassword.setText("");
}//if Closed
} catch (Exception x) {

19
JOptionPane.showMessageDialog(null, "Error,Unable to perform database operation",
"Error", JOptionPane.ERROR_MESSAGE);
}//inner try catch closed
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "Error on database connection, Cannot perform
database operation", "Error", JOptionPane.ERROR_MESSAGE);
}//outer try catch closed
}//actionPerformed() closed
}//class closed

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

public class Deleteuser extends JInternalFrame implements ActionListener {

private JLabel lblUName = new JLabel("User name");


private JComboBox cmbUName = new JComboBox();
private JButton btnDelete = new JButton("Delete", new
ImageIcon(ClassLoader.getSystemResource("Images/delusr.png")));

public Deleteuser() {
super("Delete user accounts", false, true, false, true);
setBounds(350, 200, 300, 200);

20
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setLayout(null);
lblUName.setBounds(30, 30, 100, 30);
cmbUName.setBounds(120, 30, 130, 25);
btnDelete.setBounds(100, 90, 100, 25);
add(lblUName);
add(cmbUName);
add(btnDelete);
btnDelete.addActionListener(this);
LoadUserames();
}

public void actionPerformed(ActionEvent e) {


try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:student");
Statement st = con.createStatement();
String Type;
try {
if (e.getSource() == btnDelete) {
String sql = "delete from UAD where Username='" +
cmbUName.getSelectedItem().toString() + "'";
st.executeUpdate(sql);
JOptionPane.showMessageDialog(null, "Database successfully updated", "Success",
JOptionPane.INFORMATION_MESSAGE);
LoadUserames();
}
} catch (Exception x) {
JOptionPane.showMessageDialog(null, "Error,Unable to perform database operation",
"Error", JOptionPane.ERROR_MESSAGE);
}//inner try catch closed
} catch (Exception ex1) {
JOptionPane.showMessageDialog(null, "Error on database connection, Cannot perform
database operation", "Error", JOptionPane.ERROR_MESSAGE);

21
}//outer try catch closed
}//actionPerformed() closed
private void LoadUserames() {
String name;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:student");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select Username from UAD");
cmbUName.removeAllItems();
while (rs.next()) {
name=rs.getString(1);
if (!(name.equalsIgnoreCase("admin"))) {
cmbUName.addItem(name);
}
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "Error while loading users list, Closing window" +
ex.toString());
this.dispose();
}//try catch clsoed
}
}//class closed

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.Statement;
import javax.swing.ImageIcon;
import javax.swing.JButton;

22
import javax.swing.JComboBox;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class NewStdReg extends JInternalFrame implements ActionListener {

private JPanel panel;


private JButton btnSave, btnCancel, btnClear;
private JLabel lblName, lblAdNo, lblPhNo, lblSex, lblFatherName, lblOccupation;
private JLabel lblMotherName, lblDOB, lblAge, lblCaste, lblReligion, lblHouseName;
private JLabel lblCity, lblDistrict, lblState, lblPin, lblYear, lblQualification;
private JTextField txtName, txtAdNo, txtPhNo, txtFatherName, txtOccupation;
private JTextField txtMotherName, txtDOB, txtAge, txtCaste, txtReligion,
txtHouseName;
private JTextField txtCity, txtDistrict, txtState, txtPin, txtYear, txtQualification;
private JComboBox cmbSex;
private Connection con;
private PreparedStatement ps;
private Statement st;

public NewStdReg() {
super("New Student Registration", true, true, true, true);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.setSize(1000, 1000);

panel = new JPanel();


lblAdNo = new JLabel("Admission no");
lblName = new JLabel("Name");
lblPhNo = new JLabel("Phone no");
lblSex = new JLabel("Sex");
lblFatherName = new JLabel("Father's name");

23
lblOccupation = new JLabel("Occupation");
lblMotherName = new JLabel("Mother's name");
lblDOB = new JLabel("DOB");
lblAge = new JLabel("Age");
lblCaste = new JLabel("Caste");
lblReligion = new JLabel("Religion");
lblHouseName = new JLabel("House Name");
lblCity = new JLabel("City");
lblDistrict = new JLabel("District");
lblState = new JLabel("State");
lblPin = new JLabel("Pin");
lblYear = new JLabel("Year");
lblQualification = new JLabel("Qualification");

txtName = new JTextField();


txtAdNo = new JTextField();
txtPhNo = new JTextField();
//txtSex = new JTextField();
cmbSex = new JComboBox();
cmbSex.addItem("MALE");
cmbSex.addItem("FEMALE");
cmbSex.setSelectedIndex(0);
txtFatherName = new JTextField();
txtOccupation = new JTextField();
txtMotherName = new JTextField();
txtDOB = new JTextField();
txtAge = new JTextField();
txtCaste = new JTextField();
txtReligion = new JTextField();
txtHouseName = new JTextField();
txtCity = new JTextField();
txtDistrict = new JTextField();
txtState = new JTextField();
txtPin = new JTextField();

24
txtQualification = new JTextField();
txtYear = new JTextField();

btnSave = new JButton("Save", new


ImageIcon(ClassLoader.getSystemResource("Images/save.png")));
btnCancel = new JButton("Cancel", new
ImageIcon(ClassLoader.getSystemResource("Images/cancel.png")));
btnClear = new JButton("Clear", new
ImageIcon(ClassLoader.getSystemResource("Images/clear.png")));
btnSave.addActionListener(this);
btnCancel.addActionListener(this);
btnClear.addActionListener(this);

panel.setLayout(null);

lblAdNo.setBounds(100, 50, 150, 25);


txtAdNo.setBounds(200, 50, 200, 25);
lblName.setBounds(100, 90, 150, 25);
txtName.setBounds(200, 90, 200, 25);
lblPhNo.setBounds(100, 130, 150, 25);
txtPhNo.setBounds(200, 130, 200, 25);
lblSex.setBounds(100, 170, 150, 25);
cmbSex.setBounds(200, 170, 200, 25);
lblFatherName.setBounds(100, 210, 150, 25);
txtFatherName.setBounds(200, 210, 200, 25);
lblOccupation.setBounds(100, 250, 100, 25);
txtOccupation.setBounds(200, 250, 200, 25);
lblMotherName.setBounds(100, 290, 100, 25);
txtMotherName.setBounds(200, 290, 200, 25);
lblDOB.setBounds(100, 330, 150, 25);
txtDOB.setBounds(200, 330, 200, 25);
lblCaste.setBounds(100, 370, 150, 25);
txtCaste.setBounds(200, 370, 200, 25);

25
lblAge.setBounds(500, 90, 150, 25);
txtAge.setBounds(600, 90, 200, 25);
lblReligion.setBounds(500, 130, 100, 25);
txtReligion.setBounds(600, 130, 200, 25);
lblHouseName.setBounds(500, 170, 100, 25);
txtHouseName.setBounds(600, 170, 200, 25);
lblCity.setBounds(500, 210, 150, 25);
txtCity.setBounds(600, 210, 200, 25);
lblDistrict.setBounds(500, 250, 100, 25);
txtDistrict.setBounds(600, 250, 200, 25);
lblState.setBounds(500, 290, 50, 25);
txtState.setBounds(600, 290, 200, 25);
lblPin.setBounds(500, 330, 150, 25);
txtPin.setBounds(600, 330, 200, 25);
lblYear.setBounds(500, 370, 100, 25);
txtYear.setBounds(600, 370, 200, 25);
lblQualification.setBounds(100, 420, 80, 25);
txtQualification.setBounds(200, 420, 600, 25);

btnSave.setBounds(300, 470, 100, 25);


btnCancel.setBounds(450, 470, 100, 25);
btnClear.setBounds(600, 470, 100, 25);

panel.add(lblAdNo);
panel.add(txtAdNo);
panel.add(lblName);
panel.add(txtName);
panel.add(lblPhNo);
panel.add(txtPhNo);
panel.add(lblSex);
panel.add(cmbSex);
panel.add(lblFatherName);
panel.add(txtFatherName);
panel.add(lblOccupation);

26
panel.add(txtOccupation);
panel.add(lblMotherName);
panel.add(txtMotherName);
panel.add(lblDOB);
panel.add(txtDOB);
panel.add(lblAge);

panel.add(txtAge);
panel.add(lblCaste);
panel.add(txtCaste);
panel.add(lblReligion);
panel.add(txtReligion);

panel.add(lblHouseName);
panel.add(txtHouseName);
panel.add(lblCity);
panel.add(txtCity);
panel.add(lblDistrict);
panel.add(txtDistrict);
panel.add(lblState);
panel.add(txtState);
panel.add(lblPin);
panel.add(txtPin);
panel.add(txtYear);
panel.add(lblYear);
panel.add(lblQualification);
panel.add(txtQualification);
panel.add(btnSave);
panel.add(btnCancel);
panel.add(btnClear);
add(panel, BorderLayout.CENTER);
//getAdmissionNo();

}//constructor closed

27
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equalsIgnoreCase("Save")) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:student");
try {
String str = "insert into student(RollNo,SName,Phno,Sex,FName,Occupation," +
"MName,Dob,Age,Caste,Religion,Hname,City,District,State,pin,Year,Qualification)" +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
PreparedStatement ps = con.prepareStatement(str);
ps.setString(1, txtAdNo.getText());
ps.setString(2, txtName.getText());
ps.setString(3, txtPhNo.getText());
ps.setString(4, cmbSex.getSelectedItem().toString());
ps.setString(5, txtFatherName.getText());
ps.setString(6, txtOccupation.getText());
ps.setString(7, txtMotherName.getText());
ps.setString(8, txtDOB.getText());
ps.setString(9, txtAge.getText());
ps.setString(10, txtCaste.getText());
ps.setString(11, txtReligion.getText());
ps.setString(12, txtHouseName.getText());
ps.setString(13, txtCity.getText());
ps.setString(14, txtDistrict.getText());
ps.setString(15, txtState.getText());
ps.setString(16, txtPin.getText());
ps.setString(17, txtYear.getText());
ps.setString(18, txtQualification.getText());
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "Registration details successfully updated",
"Success", JOptionPane.INFORMATION_MESSAGE);
ClearForm();
} catch (Exception x) {

28
JOptionPane.showMessageDialog(null, "Error on database operation,Updation failure",
"Error", JOptionPane.ERROR_MESSAGE);
}//inner try catch closed
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "Error on connection to database, cannot continue
updation process", "Error", JOptionPane.ERROR_MESSAGE);
}//outer try catch closed
}//if closed
if (e.getActionCommand().equalsIgnoreCase("Clear")) {
ClearForm();
}//if closed
if (e.getActionCommand().equalsIgnoreCase("Cancel")) {
this.dispose();
}//if closed
}

private void ClearForm() {


txtAdNo.setText("");
txtName.setText("");
cmbSex.setSelectedIndex(0);
txtFatherName.setText("");
txtOccupation.setText("");
txtMotherName.setText("");
txtDOB.setText("");
txtAge.setText("");
txtPhNo.setText("");
txtCaste.setText("");
txtReligion.setText("");
txtHouseName.setText("");
txtCity.setText("");
txtDistrict.setText("");
txtState.setText("");
txtPin.setText("");
txtYear.setText("");

29
txtQualification.setText("");
}//clearform() closed
/*private void getAdmissionNo() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:student");
try {
st = con.createStatement();
ResultSet rs = st.executeQuery("SELECT MAX(RollNo) FROM student");
JOptionPane.showMessageDialog(null, "ttt");
if (rs.next()) {
int no=Integer.parseInt(rs.getString(0));
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error on retrieving admission number" +
e.toString(), "Error", JOptionPane.ERROR_MESSAGE);
}//inner try closed
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "Error on database connection, Closing window",
"Error", JOptionPane.ERROR_MESSAGE);
}//try catch closed
}//getAdmissionNo() closed*/
}//class closed
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.ImageIcon;
import javax.swing.JButton;

30
import javax.swing.JComboBox;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class EditStdReg extends JInternalFrame implements ActionListener {

private JPanel panel;


private JButton btnUpdate, btnCancel, btnView;
private JLabel lblName, lblAdNo, lblPhNo, lblSex, lblFatherName, lblOccupation;
private JLabel lblMotherName, lblDOB, lblAge, lblCaste, lblReligion, lblHouseName;
private JLabel lblCity, lblDistrict, lblState, lblPin, lblYear, lblQualification;
private JTextField txtName, txtAdNo, txtPhNo, txtFatherName, txtOccupation;
private JTextField txtMotherName, txtDOB, txtAge, txtCaste, txtReligion,
txtHouseName;
private JTextField txtCity, txtDistrict, txtState, txtPin, txtYear, txtQualification;
private JComboBox cmbSex;
private Connection con;
private Statement st;
private PreparedStatement ps;
private int adno;

public EditStdReg() {
super("Edit Student Registration", true, true, true, true);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.setSize(1000, 1000);

panel = new JPanel();


lblAdNo = new JLabel("Admission no");
lblName = new JLabel("Name");
lblPhNo = new JLabel("Phone no");
lblSex = new JLabel("Sex");

31
lblFatherName = new JLabel("Father's name");
lblOccupation = new JLabel("Occupation");
lblMotherName = new JLabel("Mother's name");
lblDOB = new JLabel("DOB");
lblAge = new JLabel("Age");
lblCaste = new JLabel("Caste");
lblReligion = new JLabel("Religion");
lblHouseName = new JLabel("House Name");
lblCity = new JLabel("City");
lblDistrict = new JLabel("District");
lblState = new JLabel("State");
lblPin = new JLabel("Pin");
lblYear = new JLabel("Year");
lblQualification = new JLabel("Qualification");

txtName = new JTextField();


txtAdNo = new JTextField();
txtPhNo = new JTextField();
//txtSex = new JTextField();
cmbSex = new JComboBox();
cmbSex.addItem("MALE");
cmbSex.addItem("FEMALE");
cmbSex.setSelectedIndex(0);
txtFatherName = new JTextField();
txtOccupation = new JTextField();
txtMotherName = new JTextField();
txtDOB = new JTextField();
txtAge = new JTextField();
txtCaste = new JTextField();
txtReligion = new JTextField();
txtHouseName = new JTextField();
txtCity = new JTextField();
txtDistrict = new JTextField();
txtState = new JTextField();

32
txtPin = new JTextField();
txtQualification = new JTextField();
txtYear = new JTextField();

btnUpdate = new JButton("Update", new


ImageIcon(ClassLoader.getSystemResource("Images/update.png")));
btnCancel = new JButton("Cancel", new
ImageIcon(ClassLoader.getSystemResource("Images/cancel.png")));
btnView = new JButton("View", new
ImageIcon(ClassLoader.getSystemResource("Images/view.png")));
btnUpdate.addActionListener(this);
btnCancel.addActionListener(this);
btnView.addActionListener(this);

panel.setLayout(null);

lblAdNo.setBounds(100, 50, 150, 25);


txtAdNo.setBounds(200, 50, 200, 25);
lblName.setBounds(100, 90, 150, 25);
txtName.setBounds(200, 90, 200, 25);
lblPhNo.setBounds(100, 130, 150, 25);
txtPhNo.setBounds(200, 130, 200, 25);
lblSex.setBounds(100, 170, 150, 25);
cmbSex.setBounds(200, 170, 200, 25);
lblFatherName.setBounds(100, 210, 150, 25);
txtFatherName.setBounds(200, 210, 200, 25);
lblOccupation.setBounds(100, 250, 100, 25);
txtOccupation.setBounds(200, 250, 200, 25);
lblMotherName.setBounds(100, 290, 100, 25);
txtMotherName.setBounds(200, 290, 200, 25);
lblDOB.setBounds(100, 330, 150, 25);
txtDOB.setBounds(200, 330, 200, 25);
lblCaste.setBounds(100, 370, 150, 25);
txtCaste.setBounds(200, 370, 200, 25);

33
panel.add(btnView);
add(panel, BorderLayout.CENTER);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:student");
st = con.createStatement();
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "Error on connection to database, cannot continue
updation process", "Error", JOptionPane.ERROR_MESSAGE);
}//outer try catch closed

}//constructor closed
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equalsIgnoreCase("Update")) {
try {
if(adno!=Integer.parseInt(txtAdNo.getText())){
JOptionPane.showMessageDialog(null,"Roll number cannot be changed","Updation
error",JOptionPane.ERROR_MESSAGE);
return;
}
String sql = "UPDATE student SET
SName=?,Phno=?,Sex=?,Fname=?,Occupation=?,Mname=?,Dob=?" +
",Age=?,Caste=?,Religion=?,Hname=?,City=?,District=?,State=?,Pin=?,Year=?,Qualification
=?" +
" WHERE Rollno="+ adno;
ps=con.prepareStatement(sql);
ps.setString(1,txtName.getText());
ps.setString(2,txtPhNo.getText());
ps.setString(3,cmbSex.getSelectedItem().toString());
ps.setString(4,txtFatherName.getText());
ps.setString(5,txtOccupation.getText());
ps.setString(6,txtMotherName.getText());
ps.setString(7,txtDOB.getText());

34
ps.setInt(8,Integer.parseInt(txtAge.getText()));
ps.setString(9,txtCaste.getText());
ps.setString(10,txtReligion.getText());
ps.setString(11,txtHouseName.getText());
ps.setString(12,txtCity.getText());
ps.setString(13,txtDistrict.getText());
ps.setString(14,txtState.getText());
ps.setString(15,txtPin.getText());
ps.setInt(16,Integer.parseInt(txtYear.getText()));
ps.setString(17,txtQualification.getText());
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "Registration details successfully updated",
"Success", JOptionPane.INFORMATION_MESSAGE);
ClearForm();
btnUpdate.setEnabled(false);
} catch (Exception x) {
JOptionPane.showMessageDialog(null, "Error on database operation,Updation failure",
"Error", JOptionPane.ERROR_MESSAGE);
}//inner try catch closed
}//if closed
if (e.getActionCommand().equalsIgnoreCase("View")) {

try {
ResultSet rs = st.executeQuery("SELECT * FROM student WHERE RollNo=" +
txtAdNo.getText());
if (rs.next()) {
adno = Integer.parseInt(txtAdNo.getText());
txtName.setText(rs.getString("SName"));
cmbSex.setSelectedItem(rs.getString("Sex"));
txtFatherName.setText(rs.getString("FName"));
txtMotherName.setText(rs.getString("MName"));
txtAge.setText(rs.getString("Age"));
txtOccupation.setText(rs.getString("Occupation"));
txtPhNo.setText(rs.getString("phno"));

35
txtReligion.setText(rs.getString("Religion"));
txtHouseName.setText(rs.getString("Hname"));
txtCaste.setText(rs.getString("Caste"));
txtCity.setText(rs.getString("City"));
txtState.setText(rs.getString("State"));
txtDOB.setText(rs.getDate("Dob").toString());
txtDistrict.setText(rs.getString("District"));
txtPin.setText(rs.getString("Pin"));
txtYear.setText(rs.getString("Year"));
txtQualification.setText(rs.getString("Qualification"));
btnUpdate.setEnabled(true);
} else {
JOptionPane.showMessageDialog(null, "Roll No not found in database", "Not found",
JOptionPane.INFORMATION_MESSAGE);
ClearForm();
btnUpdate.setEnabled(false);
}//if else closed
} catch (Exception x) {
JOptionPane.showMessageDialog(null, "Error on database operation,Updation failure",
"Error", JOptionPane.ERROR_MESSAGE);
}//inner try catch closed

}//if closed
if (e.getActionCommand().equalsIgnoreCase("Cancel")) {
this.dispose();
}//if closed
}

private void ClearForm() {


txtAdNo.setText("");
cmbregno.setBounds(120, 30, 130, 25);
btnMark.setBounds(100, 100, 100, 30);
add(jlreno);
add(cmbregno);

36
add(btnMark);

btnMark.addActionListener(this);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:student");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select RollNo from student");
cmbregno.removeAllItems();
while (rs.next()) {
cmbregno.addItem(rs.getString(1));
}
} catch (Exception ee) {
}
}

public void actionPerformed(ActionEvent e) {


if (e.getSource() == btnMark) {
String regno = (String) cmbregno.getSelectedItem();
String qlfn;
try {
Statement st = Settings.getDBConnection().createStatement();
int rno = Integer.parseInt(regno);
ResultSet rs = st.executeQuery("SELECT Qualification from student Where Rollno= " +
rno);
if (rs.next()) {
qlfn = rs.getString(1);
ViewMarkReport frm = new ViewMarkReport(regno, qlfn);
userMDI.desktop.add(frm);
frm.setVisible(true);
dispose();
}
MarkS frm = new MarkS(regno);
frm.setVisible(true);

37
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "Error on Loading report", "Error",
JOptionPane.ERROR_MESSAGE);
}
}
}

38
10.OUTPUT

Fig : 1

Fig : 2

Fig : 3

39
Fig : 4

Fig : 5

40
Fig : 6

Fig : 7

41
Fig : 8

Fig : 9

42
Fig : 10

Fig : 11

Fig: 12

43
11.CONCLUSION

Our project is only a humble venture to satisfy the needs in an Institution. Several user
friendly coding have also adopted. This package shall prove to be a powerful package in
satisfying all the requirements of the organization. The objective of software planning is to
provide a frame work that enables the manger to make reasonable estimates made within a
limited time frame at the beginning of the software project and should be updated regularly
as the project progresses.

12.REFERENCE

➢ http://www.javaworld.com/javaworld/jw-01-1998/jw-01-bookreview.html
➢ Database Programming with JDBC and Java by O'Reilly
➢ Head First Java 2nd Edition
➢ http://www.jdbc-tutorial.com/
➢ Java and Software Design Concepts by APress

44

You might also like