私には2つの問題がありますが、現在は1つだけ修正に取り組んでいます。331行目のプログラムで実行すると、SQLステートメントにエラーがあるというエラー( catchステートメント)が表示されます。それは他のもの(私が見るもの)と同一であり、私はエラーを見ていません。これがエラーを出すセクションの抜粋です。他のセクションと同じように、mysqlデータベースを更新できるはずです。これはエラーです。どこを見ればいいですか?何かが正しく投稿されませんでした、私もそれを見ています、ごめんなさい。
//String st = "DELETE FROM student WHERE Description = 'Michael'";
// String st = “UPDATE student SET Description = + ‘Michael’ WHERE studentID = ‘123’”;
String studentID;
String firstName;
String lastName;
double gpa;
String status;
String mentor;
String level;
String thesisTitle;
String thesisAdvisor;
String company;
Scanner in = new Scanner(System.in);
// print statements to match the database input
System.out.println("Now let's update a record");
System.out.println("Please enter the student ID of the record you want to update >");
studentID = in.next();
System.out.println("Please enter the new First Name >");
firstName = in.next();
System.out.println("Please enter the new Last Name >");
lastName = in.next();
System.out.println("Please enter the new GPA[X.XX] >");
gpa = in.nextDouble();
System.out.println("Please enter the new Status [Active or Inactive] >");
status = in.next();
System.out.println("Please enter the new mentor >");
mentor = in.next();
System.out.println("Please enter the new level >");
level = in.next();
System.out.println("Please enter the new thesis Title >");
thesisTitle = in.next();
System.out.println("Please enter the new thesis Advisor's name >");
thesisAdvisor = in.next();
System.out.println("Please enter the new Company Name >");
company = in.next();
// stmt.executeUpdate("Update student Set studentID='" + studentID + "', firstName='" + firstName + "', lastName='" + lastName + "', gpa=" + gpa + "', status='" + status + "', mentor='" + mentor + "', level='" + level + "', theseisTitle='" + thesisTitle + "', thesisAdvisor='" + thesisAdvisor + "', company='" + company + "WHERE studentID = '" + studentID + " '");
stmt.executeUpdate("Update student Set studentID='" + studentID + "',firstName'" + firstName + "', lastName='" + lastName + "', gpa=" + gpa + "', status='" + status + "', mentor='" + mentor + "', level='" + level + "', theseisTitle='" + thesisTitle + "', thesisAdvisor='" + thesisAdvisor + "', company='" + company + "WHERE studentID = '" + studentID + " '");
// Close the statement and the connection
stmt.close();
conn.close();
} catch (Exception e) {
System.err.println("ERROR: Either cannot connect to the DB " + " or error with the SQL statement");
}