したがって、行のIDを提供するこのコードがあります。
public int getIdSala(Connection conn, String t) {
try {
String query = "Select id_sala from sala where nume = ?";
PreparedStatement st = conn.prepareStatement(query);
st.setString(1, t);
ResultSet rs = st.executeQuery(query);
id = rs.getInt("Id_sala");
} catch (Exception e) {
System.err.println("Got an exception!");
System.err.println(e.getMessage());
}
return id;
}
そして、次のエラーが表示されます。
You have an error in your SQL syntax; check the manual that corresponds to your MySQLserver version for the right syntax to use near '?' at line 1
何が問題なのですか?