Advertisement
Guest User

Untitled

a guest
Apr 14th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. <%@page import = "java.sql.ResultSet"%>
  2. <%@page import = "java.sql.Connection"%>
  3. <%@page import = "java.sql.DriverManager"%>
  4. <%@page import = "java.sql.Connection"%>
  5. <%@page import = "java.sql.Statement"%>
  6. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  7. <!DOCTYPE html>
  8. <html>
  9. <head>
  10. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  11. <title> Report </title>
  12. </head>
  13. <body>
  14. <%
  15. Connection connection = null;
  16. try {
  17. Class.forName("org.gjt.mm.mysql.Driver");
  18. String url = "jdbc:mysql://localhost/businessrequirement";
  19. String user = "root";
  20. String pwd = "";
  21. connection = DriverManager.getConnection(url, user, pwd);
  22.  
  23. int report=Integer.parseInt(request.getParameter("orderID"));
  24.  
  25. Statement statement = connection.createStatement();
  26.  
  27. String query="SELECT * FROM orderrecord, delivery, employee"
  28. + " WHERE orderrecord.orderID=delivery.orderID"
  29. + " AND employee.employeeID=orderrecord.employeeID"
  30. + " AND orderrecord.orderID='"+report+"'";
  31.  
  32. ResultSet rows = statement.executeQuery(query);
  33.  
  34. out.println("<table border=2>");
  35. out.println("<tr><th> Courier Status </th>");
  36. while (rows.next())
  37. {
  38.  
  39. String Cstatus=rows.getString("courierStatus");
  40.  
  41. out.println("<tr><td>"+Cstatus+"</td></tr>");
  42. }
  43.  
  44. out.print("</table>");
  45.  
  46. }
  47. catch(Exception e)
  48. {
  49. //response.sendError(HttpServletResponse.SC_NOT_FOUND);
  50. out.print(e);
  51. }
  52. finally
  53. {
  54. if(null != connection)
  55. {
  56. connection.close();
  57. }
  58. }
  59. %>
  60. </body>
  61. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement