User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 429,747 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,077 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting

how to delete multiple records using jsp

Join Date: May 2008
Posts: 3
Reputation: Sprashant is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
Sprashant Sprashant is offline Offline
Newbie Poster

Re: how to delete multiple records using jsp

  #3  
Jun 9th, 2008
  1. <html>
  2. <body>
  3.  
  4. <table width="50%" border="1" rules=ALL>
  5.  
  6. <tr><th> Username</th><th>Access Level</th><th>Delete</th></tr>
  7.  
  8. <%@ page language="java" import="java.sql.*" %>
  9.  
  10. <%
  11.  
  12. int j=0;
  13.  
  14. Connection con =null;
  15.  
  16. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  17.  
  18. con=DriverManager.getConnection("jdbc:odbc:udsn","","");
  19.  
  20. Statement st=con.createStatement();
  21.  
  22. ResultSet rs=st.executeQuery("select * from staff");
  23.  
  24.  
  25.  
  26. while (rs.next())
  27.  
  28. { j=j+1;%>
  29.  
  30. <tr><td align="center"><%=rs.getString(1)%></td><td align="center"><%=rs.getString(3)%></td><td><input type="checkbox" name="delete" value="yes"></tr>
  31.  
  32. <%}
  33.  
  34. %>
  35.  
  36. <form action="deleteuser.jsp">
  37.  
  38. <input type="hidden" name="recordcount" value="<%=j%>">
  39.  
  40. <input type="submit" name="b1" value="Delete" >
  41.  
  42. </table>
  43.  
  44. </form>
  45.  
  46. </body>
  47.  
  48. </html>
  49.  
  50. <html> <body> <table width="50%" border="1" rules=ALL> <tr><th> Username</th><th>Access Level</th><th>Delete</th></tr> <%@ page language="java" import="java.sql.*" %> <% int j=0; Connection con =null; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("jdbc:odbc:udsn","",""); Statement st=con.createStatement(); ResultSet rs=st.executeQuery("select * from staff"); while (rs.next()) { j=j+1;%> <tr><td align="center"><%=rs.getString(1)%></td><td align="center"><%=rs.getString(3)%></td><td><input type="checkbox" name="delete" value="yes"></tr> <%} %> <form action="deleteuser.jsp"> <input type="hidden" name="recordcount" value="<%=j%>"> <input type="submit" name="b1" value="Delete" > </table> </form> </body> </html>
Last edited by peter_budo : Jun 9th, 2008 at 3:02 am. Reason: Keep It Organized - please use [code] tags
Reply With Quote  
All times are GMT -4. The time now is 3:14 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC