In this video we will learn how to to connect a Java GUI to a MySQL database. We will create a form to add data into the database.
Please SUBSCRIBE to this channel
In this video we will learn how to to connect a Java GUI to a MySQL database. We will create a form to add data into the database.
Please SUBSCRIBE to this channel
Comments are closed.
Hey me again 😀 i have created a Jtable with text fields and etc. everything works fine but instead of salary im trying to create a Date of Birth field… everything looks fine except these lines.
protected void saveEmployee() {
// get the employee info from gui
String firstName = firstNameTextField.getText();
String lastName = lastNameTextField.getText();
String jobTitle = jobTitleTextField.getText();
Date dateOfBirth = dateOfBirthDateField.getDate();
Date dateOfBirthDate = dateOfBirthDate.getText();
//Date dateOfBirth = convertDateToString(dateOfBirthStr);
Employee tempEmployee = new Employee(lastName,
firstName, jobTitle, dateOfBirth);
Any chance you could help me out on how to add dates?
Hi Jason,
I just made a new blog post for adding a Date of Birth field (source code included). Enjoy!
http://goo.gl/nfQJrq
by the way getting date from database works fine, but adding date from GUI to the table is where my struggle starts
Hello, I’m James and I’m desperate need of your help.
I followed every tutorial up until 12.6, adding of a user. I am at a dead end here cause my AddEmployeeDialog will not run. It’s showing an error at
Employee tempEmployee = new Employee(firstName, lastName, email, salary);
Is it not something to do with the “id” variable which is not declared in this situation?
James
Regards
Hi James,
Here’s a link to the solution code from the video. You can compare your code against the solution.
https://luv2code.com/wp-content/uploads/2014/09/jdbc-swing-gui-add-employee.zip
If you are not able to find the problem, then you can use the solution code as a starting point and continue from there.
Let me know if you need anything else.
:-)