This is a test question post - please do not answer
public int addCourse (Course course) throws SQLException
{
query = "INSERT INTO course (title) VALUES (?);";
ps = DBase.getInstance().getConnection().prepareStatement(query, 1);
ps.setString(1, course.title);
ps.execute();
rs = ps.getGeneratedKeys();
if (!rs.next())
return -1;
return course.course_id = rs.getInt(1);
}
Aucun commentaire:
Enregistrer un commentaire