I hope that you can correct me if my syntax is wrong. I could check on Google only if the SELECT...WHERE clause is correct.
I want to retrieve the student_id for using it in another query, but seems that all I get from this is a "0".
in java file:
rst = stmt.executeQuery("SELECT student_id FROM students WHERE name= 'to_delete'");
sid = rst.getInt("student_id");
to_delete is a String which this java file receives as a parameter to the method which must return student_id. It really contains the correct string(I checked it).
Table "students" contains the fileds: student_id, name, year. I need to have returned the student_id for the name "to_delete".
I have no errors/exceptions, just that when I display the result, I see id: 0 no matter what name I type. Maybe rst.getString("column_name") is correct only for executeUpdate(...)?
Thank you in advance!