my dog learned polymorphism
The moose likes JDBC and Relational Databases and the fly likes Database Changes not Showing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Database Changes not Showing" Watch "Database Changes not Showing" New topic

Database Changes not Showing

Joel Christophel
Ranch Hand

Joined: Apr 20, 2011
Posts: 249

So, I'm making an attendance program that involves SQL databases. I'm writing it via JDBC. Right now, when the program is started, a frame opens with two buttons: 'Add students' and 'Configure classes'. 'Add students' opens a JDialog that prompts for name and ID number and then stores student in the database. 'Configure classes' displays a JDialog containing a JList with all of the students in the 'students' table. This JDialog also has a JComboBox with which the user specifies which class selected JList student is added to.

The problem: When I run the program, if I first add a student to 'students' and then click 'Configure classes', the added student appears in the JList. However, if I run the program and first click 'Configure classes' and then add a student, the next time I click 'Configure classes', the newly added student doesn't appear. I'm not sure why this is happening because each time 'Configure classes' is clicked, a new JList object is created.

Here's what happens every time 'Configure classes' is clicked:

SearchPanel contains the JList, and a new JList object is made in the SearchPanel constructor.
I agree. Here's the link:
subject: Database Changes not Showing
It's not a secret anymore!