<%@page import="java.sql.DriverManager"%> <%@page import="java.sql.ResultSet"%> <%@page import="java.sql.Statement"%> <%@page import="java.sql.Connection"%> <% String driverName = "sun.jdbc.odbc.JdbcOdbcDriver"; String connectionUrl = "jdbc:odbc:sdldsn"; String dbName = "database"; String userId = "root"; String password = "root"; try { Class.forName(driverName); } catch (ClassNotFoundException e) { e.printStackTrace(); } Connection connection = null; Statement statement = null; ResultSet resultSet = null; %> <html> <body bgcolor="LightGray" text="white" > <br> <div style="width:95%;border-style:solid;border-width:3px;border-color:orange;height:600px;border-radius:15px;background-color:white;box-shadow:-1px -1px 20px orange" > <br> <br> <img src=../images/adminbar.JPG width=100% style="border-radius:15px" > <table align="center" cellpadding="5" cellspacing="5" border="1"> <br> <br> <tr bgcolor="YellowBrown"> <td>UserId</td> <td>Name</td> <td>Gender</td> <td>Remove</td> </tr> <% try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:sdldsn"); statement=con.createStatement(); String sql ="SELECT * FROM usermaster"; resultSet = statement.executeQuery(sql); while(resultSet.next()){ String uid=resultSet.getString("UserId") ; String nm=resultSet.getString("UserName") ; String gd=resultSet.getString("Gender") ; String dlink="removeuser.jsp?uid="+uid; %> <tr bgcolor="Brown"> <td><%=uid%></td> <td><%=nm%></td> <td><%=gd%></td> <td><a href='<%=dlink%>'><img src="images/delete.jpg" height=20 width=100></a></td> </tr> <% } } catch (Exception e) { e.printStackTrace(); } %> </table> </div> </body> </html>
<%@ page language="java" import="java.sql.*" %> <% String uid=request.getParameter("UserId"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:sdldsn"); String msql="delete from UserMaster where UserId="+uid; Statement smt=con.createStatement(); smt.executeUpdate(msql); con.close(); Thread.sleep(1000); response.sendRedirect("userlist1.jsp"); %>
uid
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)