Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Update information about a course
- public void setCourseInfo(String iD, JTextField newCourseName, String newCourseStart, String newCourseEnd, JComboBox newTeacher, JComboBox newSubject) {
- try {
- //Name of the new course
- String course = newCourseName.getText();
- //New id
- String tempTeacher = newTeacher.getSelectedItem().toString();
- String[] splitStr = tempTeacher.split("\\s+");
- String teacherId = getIdTeacher(splitStr[0], splitStr[1]);
- //get subject Id for course
- String courseSubject = newSubject.getSelectedItem().toString();
- String subjectId = getSubjectId(courseSubject);
- //The accual command to insert new course
- String command = "UPDATE kurs SET kursnamn= '" + course + "', kursstart= '" + newCourseStart + "', kursslut= '" + newCourseEnd + "', kurslarare= " + teacherId + ", amnestillhorighet= " + subjectId
- + "WHERE kurs_id=" + iD;
- hwdb.insert(command);
- } catch (InfException e) {
- System.out.println(e.getMessage());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement