-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete.jsp
28 lines (26 loc) · 1.04 KB
/
delete.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<%@ page import="java.sql.*"%>
<%
String firstname =request.getParameter("fname");
String lastname =request.getParameter("lname");
try{
String url = "jdbc:oracle:thin:@localhost:1521:XE";
String user = "haransh";
String pass = "haransh";
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection(url,user,pass);
PreparedStatement pst = con.prepareStatement("Delete from register where fname=? and lname=?");
pst.setString(1,firstname);
pst.setString(2,lastname);
int x= pst.executeUpdate();
if(x!=0){
out.println("deletd");
response.sendRedirect("register.html");
}
else
out.println("deleted");
}
catch(Exception e)
{
out.println(e);
}
%>