Advertisement
patrykszczur

Untitled

May 8th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. public static void insertTable(int idEmployee , String First_Name , String Last_Name , String Password , int Sex , String Mail , int Employee_idEmployee ) throws Exception {
  2.  
  3. Connection conn = (Connection) getConnection() ;
  4. try {
  5. PreparedStatement insertStatement = (PreparedStatement) conn.prepareStatement("INSERT INTO employee (?,?,?,?,?,?,?) VALUES (?,?,?,?,?,?,?)");
  6. insertStatement.setInt(1, idEmployee);
  7. insertStatement.setString(2, First_Name);
  8. insertStatement.setString(3, Last_Name );
  9. insertStatement.setString(4, Password);
  10. insertStatement.setInt(5, Sex);
  11. insertStatement.setString(6, Mail);
  12. insertStatement.setInt(7 ,Employee_idEmployee);
  13.  
  14. insertStatement.close();
  15. conn.close() ;
  16.  
  17. System.out.println("it's ok");
  18.  
  19. } catch (SQLException e) {
  20.  
  21. System.out.println(e.getMessage());
  22.  
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement