After the user logs in the "Student Management System" using "system" and "password" you get to view Student details. Also you get to choose a Student to delete or modify from the Combo box on the right hand top. When I select a student and delete using the delete button it gets deleted in the databse but how do i autorefresh the same in the Select student combobox...


I was not able to implement it...The code needs to be implemented in the ButtonHandler Classs. The snippet is as shown below

Code:
else if(s.equals("DELETE")){
						int returnValue  = JOptionPane.showConfirmDialog(null, "Delete Confirmation", 
											"Are you sure you wanna delete", JOptionPane.YES_NO_OPTION);
						if(returnValue == JOptionPane.YES_OPTION){
							selectedStudentname = jcmbStudentName.getSelectedItem().toString();
							String student_regNo= selectedStudentname.substring(0,7);
		  					deleteStudentRecord(student_regNo);
/*			JCOMBOBOX Refreshing Student Combo logic not implemented yet				
 * 			jcmbStudentName.addItem("Select Student Name");
						    PopulateStudentCombo();*/
						}
Note: PopulateStudentCombo() is a function used to populate the ComboBox.

The entire code for the above project is available at

http://www.java-swing-tutorial.com/student.zip

Database Created in Oracle

Code:
create table student_details (
	reg_no VARCHAR(30),
	name	VARCHAR(30),
	address	VARCHAR(50),
	fname	VARCHAR(30),
	dob	VARCHAR(30),
	phone	INTEGER,
	gender	VARCHAR(2),
	year	VARCHAR(30),
	course	VARCHAR(30),
	degree	INTEGER,
	charcert INTEGER,
	ncccert	INTEGER
);

create table student_login (
	login VARCHAR(30),
	password VARCHAR(30)
);

insert into student_login values('system', 'password');

These are the Database Specific settigns for JDBC

Code:
static String userid="scott", password = "tiger";
static String url = "jdbc:odbc:bob";

Regards,
Hemanth
http://www.beginner-java-tutorial.com