Guest User

Untitled

a guest
Jan 18th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. public Employee(String firstName, String lastName,
  2. String userID, String userPassword, String role)
  3. {
  4. try{
  5. Class.forName("com.mysql.jdbc.Driver");
  6. Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/hotelmanagementsystem", "some_user","");
  7.  
  8. PreparedStatement statement = con.prepareStatement("Insert into employee(Firstname, Lastname, UserID, UserPassword, Role)values(?, ?, ?, ?, ?");
  9. statement.setString(1, firstName);
  10. statement.setString(2, lastName);
  11. statement.setString(3, userID);
  12. statement.setString(4, userPassword);
  13. statement.setString(5, role);
  14. statement.executeUpdate();
  15.  
  16. con.close();
  17. }
  18. catch( Exception e ) {
  19. e.printStackTrace();
  20. return;
  21. }
  22. }
  23.  
  24. PreparedStatement statement = con.prepareStatement("Insert into employee(Firstname, Lastname, UserID, UserPassword, Role)values(?, ?, ?, ?, ?");
  25.  
  26. PreparedStatement statement = con.prepareStatement("Insert into employee(Firstname, Lastname, UserID, UserPassword, Role)values(?, ?, ?, ?, ?)");
  27.  
  28. PreparedStatement statement = con.prepareStatement("Insert into employee(Firstname, Lastname, UserID, UserPassword, Role)values(?, ?, ?, ?, ?");
  29.  
  30. PreparedStatement statement = con.prepareStatement("Insert into employee(Firstname, Lastname, UserID, UserPassword, Role)values(?, ?, ?, ?, ?)");
  31.  
  32. PreparedStatement statement = con.prepareStatement("Insert into employee(Firstname, Lastname, UserID, UserPassword, Role)values(?, ?, ?, ?, ?)");
Add Comment
Please, Sign In to add comment