Advertisement
Guest User

Untitled

a guest
Feb 26th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. static void signUp(){
  2. System.out.println("nSign Up For a Classn");
  3. try {
  4. Scanner input = new Scanner(System.in);
  5. System.out.println("Enter Student ID: ");
  6. String user_entered_student_id = input.nextLine();
  7. Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/ClassSelector", "", "");
  8. Statement myStmt = con.createStatement();
  9. ResultSet rs;
  10. rs = myStmt.executeQuery("SELECT student_name FROM ClassSelector.students WHERE student_id = user_entered_student_id");
  11. while(rs.next()){
  12. String userEnterId = rs.getString("student_name");
  13. System.out.println("Is " + userEnterId + " the correct student?");
  14. }
  15.  
  16. }
  17. catch (Exception exc){
  18. exc.printStackTrace();
  19. }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement